Got it, thanks for the explanation!
Just as a quick side note, with the changed XN file for C22 (increased delay) our reboot code doesn't work anymore - no idea why, but also not too important as long as we can use our old XN with the new tools release.
Code: Select all
void reboot_device(void)
{
unsigned int pllVal;
unsigned int localTileId = get_local_tile_id();
unsigned int tileId;
unsigned int tileArrayLength;
#ifdef DEBUG
printstrln("Reboot...");
#endif
asm volatile ("ldc %0, tile.globound":"=r"(tileArrayLength));
/* Check if reboot is called on tile 0 (tile connected to flash), otherwise throw error! */
//assert(get_local_tile_id() == get_tile_id(tile[0]) && msg("Function can only be called on tile[0] (tile connected to SPI flash)!"));
/* Reset all remote tiles in reverse order to ensure links to second chip
* on dual chip boards isn't killed before second chip is rebooted
*/
for(int i = tileArrayLength - 1; i >= 0; i--)
{
// Cannot cast tileref to unsigned
tileId = get_tile_id(tile[i]);
// 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);
}
Simon