why ATAT RX clock invalid when run MIDI on xu224 board Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
susanyin0501
Active Member
Posts: 45
Joined: Thu Apr 20, 2017 9:00 am

Post by susanyin0501 »

Hi infiniteimprobability
In this project, i have an other issue, DFU can't download image. would you please give some advices, thanks
we found DFU_mode_active can't be set, and maybe device_reboot( ) have some problem.
the following souce just can loop 1 time, the second time just can read_sswitch_reg( ), but can't write_sswitch_reg( ) then exit loop


void device_reboot_aux(void)
{
#if (XUD_SERIES_SUPPORT == XUD_U_SERIES)
/* Disconnect from bus */
unsigned data[] = {4};
write_periph_32(usb_tile, XS1_SU_PERIPH_USB_ID, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 1, data);

/* Ideally we would reset SU1 here but then we loose power to the xcore and therefore the DFU flag */
/* Disable USB and issue reset to xcore only - not analogue chip */
write_node_config_reg(usb_tile, XS1_SU_CFG_RST_MISC_NUM,0b10);
#else
unsigned int pllVal;
unsigned int localTileId = get_local_tile_id();
unsigned int tileId;
unsigned int tileArrayLength;

/* Find size of tile array - note in future tools versions this will be available from platform.h */
asm volatile ("ldc %0, tile.globound":"=r"(tileArrayLength));

/* Reset all remote tiles */
for(int i = 0; i< tileArrayLength; i++)
{
/* Cannot cast tileref to unsigned! */
tileId = get_tile_id(tile);

/* Do not reboot local tile yet! */
if(localTileId != tileId)
{
read_sswitch_reg(tileId, 6, pllVal);
pllVal &= PLL_MASK;
write_sswitch_reg_no_ack(tileId, 6, pllVal);
}
}
/* Finally reboot this tile! */
read_sswitch_reg(localTileId, 6, pllVal);
pllVal &= PLL_MASK;
write_sswitch_reg_no_ack(localTileId, 6, pllVal);
#endif
}
Attachments
无标题.png
(37.55 KiB) Not downloaded yet
无标题.png
(37.55 KiB) Not downloaded yet


View Solution
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Glad things have improved.

Hmm - OK DFU can also use channel but this should only be the case if USB is not on the same tile as the flash. I think USB is on tile 0 for you so should be OK and it will not need an extra channel.

It may be something to do with the order of reboot if that is not getting through the loop. You need to reboot the furthest away tiles first and then yourself last. Try reversing the for loop..
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Actually thinking about this further - this code will get the wrong result for XS2 (xcore200) where there are more than 2 tiles in the system
On your device there are two tiles per PLL and so two will get reset at the same time. So we only need to make 2 resets.

To work around this you will need to first reset the two remote tiles (2/3) using

Code: Select all

i = tileArrayLength - 1
and then reset tiles 0/1 using

Code: Select all

i = 0
Please try this and let me know if it works.

We will file a bugzilla to update this in the future.
susanyin0501
Active Member
Posts: 45
Joined: Thu Apr 20, 2017 9:00 am

Post by susanyin0501 »

Hi infiniteimprobability,

you are right, first reset remote tiles ( just one tile is OK), then reset local tile, DFU can work well.

by the way, usually xu224 and xu232 binary code is more than 64K, so need setting FLASH_MAX_UPGRADE_SIZE=128*1024 in Makefile

Thanks for your strong support and help!

{

i = tileArrayLength -1 ;
/* Cannot cast tileref to unsigned! */
tileId = get_tile_id(tile);

/* Do not reboot local tile yet! */
if(localTileId != tileId)
{
read_sswitch_reg(tileId, 6, pllVal);
pllVal &= PLL_MASK;
write_sswitch_reg_no_ack(tileId, 6, pllVal);
}
}


/* Finally reboot this tile! */
read_sswitch_reg(localTileId, 6, pllVal);
pllVal &= PLL_MASK;
write_sswitch_reg_no_ack(localTileId, 6, pllVal);
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Glad it's working!
Thanks for the info about 64kB limit too. That was originally an optimisation to reduce time spent waiting for erase and number of images you can fit in small (1Mb) SPI (just 2) but this is less relevant now we have modern 8Mb QSPI devices..
Post Reply