In order to operate the ADC you have to set up which channels you wish to use, sample bit size and padding and how that data gets efficiently packaged before routing over an xmos links. You then also have to trigger the ADC using the loop-back 1 bit port from application tile to ADC tile. It is more complicated (on Startkit) because the ADC tile is linked to a different tile (the debug tile) rather than the application tile where your code runs. There is also some house keeping code that checks you are setting the ADC up in a valid way, hence the asserts and logging. The final piece unpacks of the samples after receiving them across the link ready for your use.dimitris wrote:Hi everybody,
it's nice to watch this thread!
I was having the same problems as MatCat and Folknology's solution worked for me. Just make sure you add the -fxscope flag in both the debug and release flags
I was expecting an API for the analogue part. Fortunately Folkonology's module brings the whole thing closer to that.
It would be nice if someone could give us more context on why is the whole thing needed! I was expecting that it would be as trivial as writing and reading some registers.
This is what I was expecting it would make it run.
Code: Select all
data = 0x10201; write_periph_32(adc_tile, 2, 0x20, 1, data);
I would also appreciate some more insight on the reading of the samples.How come and this is different from reading a channel.
Code: Select all
unsigned int samps = inuint(c); chkct(c, 1);
Folkonogy, I still get some preprocessor erros when I use your module. More specificaly it fails to find the xassert and the debug_print libraries. Removing those and replaycing the printing with standard prints made it work for the time being.
The inxxxx(c) and chkct(c,y) calls are not compatible with ':>' XC channel operators, data from the ADC (operating as a service) sent over the channel, requires a manual read and checking of tokens etc..
You can find the extra assert and logging modules in the SC_util on github/xcore