how to calculate the time of one ADS1259 in continious mode with a teensy3.2

Status
Not open for further replies.

Bastiaan

Well-known member
Hello,

recently we have developed a circuit board that requires 2 ADS1259 for reading sensors from 0....5V over SPI with a maximum frequency of 8MHz, and I am wondering if it is fast enough.

Teensy3.2 is used. the Information from both ADS1259 is compared(substracted) and put into a PID to drive a bipolar current source for a TEC. so far so good, but I assume that it is too slow based for our TEC.

so let me explain and hope that you can help me solve or guide me in solving the following questions:

what I understand is, (somehow)

handling the process of data: The first ADS1259 starts in continious mode, record the 24 bit data and is then written to a buffer on the microprocessor. If this is complete a flag is set and the the other ads1259 takes over, with the same configuration. The values are compared in the PID which drives another SPI MAX5144. the information from both the sensors and max5144 are then read, processed and displayed on a small oled screen 10x a second or 100x a second. works like a charm but the speed of the PID is not fast enough. (PID is from Brett Beaugard). the signal input is a squarewave, and the output is the signal that follows slowly.

what I dont understand is:

1how can I calculate the processing speed of one ADS1259, processing 24 bit as fast as possible. (starttime, collect data, stoptime, senddata to the microprocessor.

is there a PDF or a book, or a Online Seminar that explains this quite well?

I would like to know how to select the right ADC converter for the right application

how do I know that it is fast enough, did I select the right Microprocessor?)

( I really like to understand the magic behind this, so that I can adapt it for other projects)

2 how does the FIFO mode between both ads1259 and the MAX5144(SPI to analog output(0...5V, no further communciation just output) affect the processing speed of the PID control loop (PID_library Arduino from Brett Beauguard)

3 Is there a better PID algorithmn on the market that reacts faster based upon the input signals from the both ads1259?,is there a pdf for this?

4 I would like to know how I can calculate the time one ads1259 needs to process continious 24 bit data start in contnious mode and send data buffer and then stop. how can I adapt this method for other ADCS ?

5 how does this account for two ads1259 doing continious mode in FIFO? if the processing of data is done in the following order= 1,2,3 whereby ads1259=1, ads1259=2,MAX5144=3 and for;;? is this the best method that exists?

6 is the teensy3.2 microprocessor the right one with one SPI Bus?

many thanks, for taking your time to read all this, and I hope I did make some sense..

and have a nice weekend.
 

Attachments

  • PID_example.jpg
    PID_example.jpg
    64 KB · Views: 99
I have not personally used the ADS1259 A/D chip. So at best I can only give very general answers....


1how can I calculate the processing speed of one ADS1259, processing 24 bit as fast as possible. (starttime, collect data, stoptime, senddata to the microprocessor.

There isn't any one simple formula to compute this sort of thing.

Usually what you would do is measure the time your code takes. Rarely is the goal "as fast as possible". Well, unless you're writing a software library... but for a "normal" project you normally have some external constrain that defines "fast enough". For example, the ADS1259 has a maximum rate of 14 kHz, though my impression is it would normally be used in a slower mode to get higher resolution. But if using the fastest mode, you can only get a new measurement every 71.4 microseconds. If you can do everything in less than 71 us, then who cares about going any faster?

Figure 61 on page 31 of the ADS1259 shows 6 bytes on the SPI bus needed, so at 8 MHz you will take at least 6 of those 71 just to read the data.

3 Is there a better PID algorithmn on the market that reacts faster based upon the input signals from the both ads1259?,is there a pdf for this?

I'd go with the well tested library first. The very first thing I'd do is measure how long it actually takes. Maybe use digitalWriteFast() to toggle a pin and watch on your oscilloscope. Or you can use micros() to get the elapsed time and print that to the serial monitor.

That library uses "double" for everything. Teensy 3.5 has a FPU, but only for 32 bit float. If the library is too slow, the simplest thing for a huge speedup would be changing every "double" to "float".

4 I would like to know how I can calculate the time one ads1259 needs to process continious 24 bit data start in contnious mode and send data buffer and then stop. how can I adapt this method for other ADCS ?

Generally this sort of things is measured. In theory you can try to calculate stuff, but odds are your mathematical model won't take software speed and other subtle points into account. A real measurement will.

6 is the teensy3.2 microprocessor the right one with one SPI Bus?

I'm going to go out on a limb a bit here to say yes, or probably yes, Teensy 3.2 or 3.5 is very likely up to this task.

Again, there isn't any one fixed way, but rather a wide range of ways to do this. I highly recommend doing things the simpler way first and actually measure the performance. Don't make things more complex if simple will do! Especially with the SPI, if you can get the data in under 10 us (6 for the SPI clocks, maybe 4 us of extra overhead), that's still only 1/7th of your total time to keep pace with the fastest possible rate of 14 kHz. Exotic approaches like DMA can free up CPU time while the data moves (as the Audio library & USB do), but that can make everything much, much harder. Put your time & effort into figuring out how much time you actually have to accomplish your task, and then do things the simplest way and measure. We can help you here with ideas for speeding things up, and that help generally gets much better when you can post code or specific details.... and you'll know those details when you've done this first round where things are the simplest way.
 
Many Many Thanks for the extensive reply,

ill have to sit back and read it thoroughly.
keep it simple, Noted...

the digitalpin trigger:)

good point about the floats, it will definitely speed things up.

I bought a logic analyzer to check the speed on the SPI bus.
Ill first have to get used to the logic analyzer and test it.

again thanks!
 
Status
Not open for further replies.
Back
Top