Reboot code work in 12.2 fail in 13.0

Technical questions regarding the XTC tools and programming with XMOS.
mmar
Experienced Member
Posts: 123
Joined: Fri Jul 05, 2013 5:55 pm

Reboot code work in 12.2 fail in 13.0

Post by mmar »

enableAEC ( STANDBY_CLOCK_DIVIDER);
c_flc :> temp;
//wait here for reboot event
{
unsigned int pllVal;
unsigned int tile_id = get_local_tile_id();
read_sswitch_reg(tile_id, 6, pllVal);

/* Not this accounts for 2 tiles of an L2.. */
write_sswitch_reg_no_ack(tile_id^0x8000, 6, pllVal);
write_sswitch_reg_no_ack(tile_id, 6, pllVal);

This work in 12 but no 13 ?


User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Post by sethu_jangala »

Use the following code:

Code: Select all

void chip_reset
{
  unsigned int pllVal;
  unsigned int tile_id; 
  tile_id= get_local_tile_id();
  read_sswitch_reg(tile_id, 6, pllVal);

  write_sswitch_reg_no_ack(get_tile_id(tile[0]), 6, pllVal);
  write_sswitch_reg_no_ack(get_tile_id(tile[1]), 6, pllVal);
}
You need to write the PLL register of other tile before writing to the tile from where you are calling the reset function.

If you are calling the chip_reset function from tile[0] the functions in the chip_reset should be in following order:
write_sswitch_reg_no_ack(get_tile_id(tile[1]), 6, pllVal);
write_sswitch_reg_no_ack(get_tile_id(tile[0]), 6, pllVal);

Hope this helps.

Sethu.
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Or to make it fully automatic and not care from which tile you called it, you could do this:

Code: Select all

void chip_reset
{
    unsigned int pllVal;
    unsigned int tile_id; 
    tile_id= get_local_tile_id();
    read_sswitch_reg(tile_id, 6, pllVal);

    if (tile_id == get_tile_id(tile[1])){ //if running from tile 1 then reset tile 0 first
        write_sswitch_reg_no_ack(get_tile_id(tile[0]), 6, pllVal);
        write_sswitch_reg_no_ack(get_tile_id(tile[1]), 6, pllVal);
    }
    else{ //othewise we're running on tile 0, so reset tile 1 first
        write_sswitch_reg_no_ack(get_tile_id(tile[1]), 6, pllVal);
        write_sswitch_reg_no_ack(get_tile_id(tile[0]), 6, pllVal);
    }
}
Obviously this code supports two tile devices - so a single two tile chip (L8-128, U8-128 to L16-128, U8-128) is assumed
Last edited by infiniteimprobability on Fri Nov 22, 2013 6:27 pm, edited 1 time in total.
Reason: added an assumption
mmar
Experienced Member
Posts: 123
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Thanks booth but my code work in 12.2.

I debug it and detect, that in 13 tile 0 have id 1, tile 1 have id 0, hmmm....

I change my xor from ^0x8000 to ^1. This work on 13.

FYI