Page 1 of 1

How to Reset xCore200?

Posted: Tue Jun 26, 2018 7:02 am
by David-dai
For xCore-XS1, we can find demo code of reset xCore-xs1, as follows:


/* Reset U8 device */
write_node_config_reg(usb_tile, XS1_SU_CFG_RST_MISC_NUM, 1);

and we can find MACRO definintion XS1_SU_CFG_RST_MISC_NUM in "xs1_su_registers.h"
#define XS1_SU_CFG_RST_MISC_NUM 0x50

for xCore200, which is the soft reset register? I can't find it, Please tell me. Thank you very much.

Re: How to Reset xCore200?

Posted: Tue Jun 26, 2018 11:50 am
by mon2
See post from Colin here:

http://www.xcore.com/viewtopic.php?t=4584

and

https://www.xmos.com/download/private/X ... 74B%29.pdf
--force-pll-reset
Will force an xCORE-200 device to reset when the PLL register is written during the
boot process. By default the xCORE-200 device will not reset when the PLL register
is written allowing for faster boot times

Re: How to Reset xCore200?

Posted: Tue Jun 26, 2018 12:57 pm
by infiniteimprobability

Re: How to Reset xCore200?

Posted: Wed Jun 27, 2018 4:44 am
by David-dai
Sorry, maybe what I need is not software reset.
I need to switch between Windows USB audio image and MFI image according the status of Switch.
For example, in xCore-XS1, we can do it as follows:

/* Load image based on state of switch, if set to dock mode we may be rebooting into MFI-enabled
USB Audio mode */
void init(void)
{
unsigned tmp;
unsigned switchVal;

/* Read state of switch */
p_sw :> switchVal;

/* Default to loading factory USB audio image (uses standard USB-B connector) */
dpVersion = IMAGE_NUM_USB_AUD_FACT;

if((switchVal & 0b1000)== 0b1000)
{
/* Switch high, USB A desired, check if we are supposed to be rebooting into USB Audio */
tmp = loadflag();

/* Check if flag set */
if(tmp == 0xDEAD)
{
dpVersion = IMAGE_NUM_USB_AUD_MFI; /* USB Audio MFI*/
}
else
{
dpVersion = IMAGE_NUM_DOCK; /* iPod Dock */
}
}
}

When we slide the switch to another side, we need to launch another image, an interruption generated, And reset the device in the interrupt handler.
on tile[0] : in port p_sw = XS1_PORT_4D;
#ifdef SW_INT_HANDLER
#ifndef SWITCH_VAL
#define SWITCH_VAL 0b0000
#endif

#pragma select handler
void handle_switch_request(in port p_sw)
{
unsigned curSwVal;

asm("in %0, res[%1]":"=r"(curSwVal):"r"(p_sw));
asm("setd res[%0], %1"::"r"(p_sw),"r"(curSwVal));

if((curSwVal & 0b0010) != SWITCH_VAL)
{
/* Reset U8 device */
write_node_config_reg(usb_tile, XS1_SU_CFG_RST_MISC_NUM, 1);
}

}
#endif

The question is How to reset xCore-200 in similar way?

Re: How to Reset xCore200?

Posted: Wed Jun 27, 2018 4:20 pm
by infiniteimprobability
Interrupts are quite fiddly in the xcore because you need to do it all at bare metal level. On XS2 (xcore200) it gets a bit more fiddly because you have to account for entry into the ISR from either dual or single issue mode. It is possible, but how about this..
The software activated reset code for xcore200 is simple enough, so why not add a poll for the switch value somewhere in a loop and then call the software reset if you see the pin high? It doesn't matter what state you leave the software in because it's a full reset..

Re: How to Reset xCore200?

Posted: Wed Jun 27, 2018 4:25 pm
by infiniteimprobability
Hmm - just checked and looks like the boot image steering stuff has been updated for xs2. It's in the MFI extension to USB audio software targeting xCORE-200 Multichannel Audio Platform (MFi).

You need to be a licensed MFI member to access it but I guess you must be already?

Re: How to Reset xCore200?

Posted: Thu Jun 28, 2018 2:34 am
by David-dai
Hi,infiniteimprobability,
Our company already got MFI authentication. If you need to check it, I will send you certification material via Email.
But for the sake of simplicity, let's suppose I just want to reboot different image according to the status of switch, and the two image have nothing to do with MFI.

Re: How to Reset xCore200?

Posted: Mon Jul 02, 2018 9:46 am
by infiniteimprobability
Hi,
it would be a lot easier just to get you the tested source code (and it's supporting functions) rather than me extracting parts of it (and running the risk of violating our MFI agreement).

If you are already MFI certified then this should be no issue, and once approved, you can just download it from myxmos. There are instructions for getting approval here:

https://www.xmos.com/support/software/uac2

Re: How to Reset xCore200?

Posted: Mon Jul 02, 2018 9:48 am
by infiniteimprobability
Ahh, i forgot about this public doc. It may help..

https://www.xmos.com/download/private/A ... rc1%29.pdf