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?
Load external device before main program
-
- Member
- Posts: 11
- Joined: Thu Apr 07, 2016 8:10 pm
-
- Active Member
- Posts: 62
- Joined: Wed Feb 17, 2016 5:10 pm
A pretty typical way to run some initialization code for a single core would be as follows:
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)
Code: Select all
some_task(){
<initialization code goes here>
while(1){
<code you want to always run goes here>
}
}
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)
-
- XCore Addict
- Posts: 185
- Joined: Tue Mar 26, 2013 12:10 pm
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,
John
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,
John