I got in a project that looks like way over my current capabilities and I need your expert help. I have an Arduino DUE board that should be used to control a few driver chips that all need to be synchronized.
I have a readout chips that would spit out analog data at 250kHZ the slowest. I was hoping to be able to use onboard ADC but decided to use external ADC that use SPI protocol (Currently looking at TI ADS1018).
I know that if I were just using the ADC chips it would have been rather easier with the standard SPI libraries however now I need to synchronize my other chips too and I'd like to use my SPI clock for that.
One driver chip for instance needs to operate at 10kHz, and needs a few clock cycle signal (at 10kHz) to start operating. I was wondering if I can count the SPI clock rising edge and use loops for clock drivers on other pins.
Now let's assume I've got 3 chips that has to work at different frequencies (1 row driver working the slowest because it has to wait all the operations completed in a row, 1 integrate and fire (I&F) kind of chip that needs X many clocks to integrate, and then Y many clocks to output 32 analog signals back to back, and the ADC which would read the values from the I&F chip only when it's outputting).
The algorithm would be something like this: 1. Start clock at 250kHz and count rising edge of this SCLK 2. At count 100, raise the row driver chip enable signal on a digital pin, raise the integrate signal pin for 25 cycles 3. At count 125 give the output signal for 5 cycles to I&F, lower slave select for the desired SS, and have it read for 32 cycles
Once the cycle counts are calculated I can put them in for loops and tell row driver clock to flip every Z many cycles to create a slower clock for it.
But the thing is, is this doable? Can I even count the clock edges of SPI? If not what would you guys suggest that I can do?
Thanks a lot in advance