Audio fails after fl_connectToDevice

New to XMOS and XCore? Get started here.
Post Reply
snap
Member
Posts: 10
Joined: Fri Jun 17, 2016 10:04 am

Audio fails after fl_connectToDevice

Post by snap »

Using:
- xCORE-200 MC Audio board
- sw_usb_audio-[sw]_6.15.2rc1
- app_usb_aud_xk_216_mc
- Windows 10
Test tone playback from control panel OK.

Modified user_main.h:

Code: Select all

#ifndef _USER_MAIN_H_
#define _USER_MAIN_H_

void user_main(void);

#define USER_MAIN_CORES \
    on tile[0] : user_main();

#endif /* _USER_MAIN_H_ */
Added user_main.xc:

Code: Select all

#include <platform.h>
#include "devicedefines.h"
#include "uac_hwresources.h"
#include <quadflash.h>
#include <stdio.h>

fl_QSPIPorts qspi_ports =
{
  on tile[0] : XS1_PORT_1B,       // qspiCS;
  on tile[0] : XS1_PORT_1C,       // qspiSCLK;
  on tile[0] : XS1_PORT_4B,       // qspiSIO;
  on tile[1] : CLKBLK_FLASHLIB    // qspiClkblk;
};

fl_QuadDeviceSpec deviceSpecs[] =
{
  FL_QUADDEVICE_SPANSION_S25FL116K,
};

void user_main(void)
{
  printf("user_main entry\n");

  int r = fl_connectToDevice(qspi_ports, deviceSpecs, sizeof(deviceSpecs)/sizeof(fl_QuadDeviceSpec));
  if (r == 0)
  {
    unsigned u = fl_getFlashSize();
    printf("fl_getFlashSize 0x%X\n", u);

    fl_disconnect();
  }
  else
  {
    printf("fl_connectToDevice failed %x\n", r);
  }

  printf("user_main exit\n");
}
The printfs show the expected values, with the expected flash size of 0x200000.
But test tone playback from control panel now fails.
USB analyzer shows that the device never returns an appropriate status for SetInterface.
If I comment out fl_connectToDevice, the test tone works again.

What am I doing wrong?


ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

Hi snap,
what is your xTIMEcomposer version?
snap
Member
Posts: 10
Joined: Fri Jun 17, 2016 10:04 am

Post by snap »

It is Community_14.2.0 (Build 11257, May-12-2016)
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

Code: Select all

fl_QSPIPorts qspi_ports =
{
  on tile[0] : XS1_PORT_1B,       // qspiCS;
  on tile[0] : XS1_PORT_1C,       // qspiSCLK;
  on tile[0] : XS1_PORT_4B,       // qspiSIO;
  on tile[1] : CLKBLK_FLASHLIB    // qspiClkblk;
};
Why qspiClkBlk is on tile[1]? I think it must be on tile[0].
snap
Member
Posts: 10
Joined: Fri Jun 17, 2016 10:04 am

Post by snap »

ffomich wrote:Why qspiClkBlk is on tile[1]? I think it must be on tile[0].
Note that flash access actually works with this configuration.
Changing to tile[0] gives build error:

Code: Select all

Analyzing user_main.xc
Creating dependencies for user_main.xc
Compiling user_main.xc
Creating app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe
xmap: Error: Symbol clk_audio_bclk is a duplicate clock declaration.
xmap: Error:   previously declared as qspi_ports.qspiClkblk.
Constraint check for tile[0]:
  Cores available:            8,   used:          3 .  OKAY
  Timers available:          10,   used:          3 .  OKAY
  Chanends available:        32,   used:          6 .  OKAY
  Memory available:       262144,   used:      27012 .  OKAY
    (Stack: 2756, Code: 20216, Data: 4040)
Constraints checks PASSED.
xmake[2]: *** [bin/2i10o10xxxxxx/app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe] Error 1
xmake[1]: *** [bin/2i10o10xxxxxx/app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe] Error 2
xmake: *** [2i10o10xxxxxx.all] Error 2

D:\sw_usb_audio-[sw]_6.15.2rc1\sw_usb_audio\app_usb_aud_xk_216_mc>
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

Yes,
in this case CLKBLK_I2S_BIT and CLKBLK_FLASHLIB are defined to XS1_CLKBLK_3 on tile[0].

Try to add

Code: Select all

while(1);
at the end of user_main(void) function.

Code: Select all

void user_main(void)
{
  ...
  printf("user_main exit\n");
  while(1);
}
snap
Member
Posts: 10
Joined: Fri Jun 17, 2016 10:04 am

Post by snap »

Solution seems to be to select an unused clock block on tile[0]:

Code: Select all

fl_QSPIPorts qspi_ports =
{
  on tile[0] : XS1_PORT_1B,       // qspiCS;
  on tile[0] : XS1_PORT_1C,       // qspiSCLK;
  on tile[0] : XS1_PORT_4B,       // qspiSIO;
  on tile[0] : XS1_CLKBLK_4       // qspiClkblk;
};
uac_hwresources.h says:

Code: Select all

/* Note, U-series XUD uses clock blocks 4 and 5 - see XUD_Ports.xc */ 
But since XUD_TILE is 1, clock blocks 4 and 5 on tile[0] are free, and can hence be used for flash access.
Post Reply