Load external device before main program

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
Posts: 11
Joined: Thu Apr 07, 2016 8:10 pm

Load external device before main program

Postby jallard » Fri Aug 11, 2017 6:55 am

I'd like to use the SPI port to program an external part from xCORE-200 before the main program starts.

Is there a way to hold-off other tiles and cores until a startup routine finishes? Or is there an existing startup routine that runs as a single threaded task, before other cores and tiles are started?
User avatar
Active Member
Posts: 57
Joined: Wed Feb 17, 2016 5:10 pm

Postby andrewxcav » Fri Sep 01, 2017 9:45 pm

A pretty typical way to run some initialization code for a single core would be as follows:

Code: Select all


    <initialization code goes here>

        <code you want to always run goes here>


For your situation where you want other cores to wait on the initialization code you will need to signal them. This should happen automatically if they are waiting for some data that gets sent (via a channel, for instance) during the while(1) portion of your code.

There are many ways to do what you want. What makes the most sense will depend on your particular problem.

AN00218 : high res delay and sum is a good example of an application that has a few peripherals that are configured via i2c and a multi-core processing chain. (do a text search for "mabs_init_pll" for an example)
User avatar
XCore Addict
Posts: 151
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Mon Sep 04, 2017 11:16 am

One feature of "par" is that it will wait for all functions to complete so you could do something like this :

void main () {
par {
iniit_fn1 () ;
iniit_fn2 () ;
par {
runtime_fn1 () ;
runtime_fn2 () ;

More details in the programming guide : https://www.xmos.com/download/private/X ... 28B%29.pdf

All the best,

Who is online

Users browsing this forum: No registered users and 11 guests