Quick question about timing
Hi All,
I don't need any detailed answer just yet.
For my Rocket controller project, i need to take 2 x 12bit samples from an ADC using SPI interface (for the accelerometer and barometer).
With the accel., I need to convert g's to acceleration, differentiate to get velocity, then again to get altitude.
With barometer I need to convert straight to alt.
I then need to store the accels. raw data, acceleration, velocity and altitude along with the barometer's raw data and altitude into the shared memory on the Prop.
How quickly do you think I could do this? I can use 1, 2 or 3 COG's (less is better obviously)
This probably isn't a simple answer! but any thoughts are appreciated.
Alec
I don't need any detailed answer just yet.
For my Rocket controller project, i need to take 2 x 12bit samples from an ADC using SPI interface (for the accelerometer and barometer).
With the accel., I need to convert g's to acceleration, differentiate to get velocity, then again to get altitude.
With barometer I need to convert straight to alt.
I then need to store the accels. raw data, acceleration, velocity and altitude along with the barometer's raw data and altitude into the shared memory on the Prop.
How quickly do you think I could do this? I can use 1, 2 or 3 COG's (less is better obviously)
This probably isn't a simple answer! but any thoughts are appreciated.
Alec
Comments
Thanks for that.
I should mention that I am aiming for about 0.5 to 1ms to do all of this.
How big is the rocket? If you are running out of cogs... this might be a perfect application for Sid's prop-on-prop piggyback. Mine survived the US mail, so it should survive a rocket launch or two...with the added weight of about one socketed Prop. If you want to add television... you could also get GPS capabilities by adding Brian Hitt's board.. add a little transmitter and you could transmit live data overlaid on the camera view to the ground.
Rich
I am designing this to be used in alot of rockets
I don't think ill run out of COG's as its all basic stuff. I am planning on using expansion boards for things like GPS and telemtry. If they prove to be to much for 1 prop I may add a prop to those expansion boards which need it
I will take a look at the piggy-prop
I am using the attached ADC
It shows a max sampling rate of 50 ksps.
It's the maximum clock rate that we're interested in here. If you want maximum speed, you'll have to do this in assembly. You'd use one cog for the ADC which would store its readings in some kind of buffer in main memory. Your calculation routines would run in another cog and store their results in a table in main memory. You may need to have some kind of external memory to store your results. I'd suggest a Ramtron FRAM (ferroelectric RAM) which works like an EEPROM, but doesn't take very long to write into (unlike an EEPROM which takes 5ms or so). These come in 32K and 64K byte sizes.
Thanks Mike,
Thats what I had in mind.
Data will be sampled at (hopefully) 1ms intervals, maybe more frequently, and calculated to find acceleration, altitude, velocity etc.
The results of all the calulations will be checked to see if they meet some preset parameters (for apogee detection, launch detection etc).
I may do the comparisons in another cog depending on how complex they are.
**Edit: up until now, all these values are stored in main memory**
If event parameters are met, another cog will trigger outputs etc and record values (alt, acceleration) at which the event happened in external memory (FRAM), while the 'main' cog(s) continues to sample and calc as above, continuously overwriting the previous samples.
Regarding storage, every 10ms, 20ms, 50ms or 100ms (user decides), I will write the most recent results (in a separate cog so as not to interupt main loop) to external storage, along with the time after launch they were sampled.
Thats the theory anyway!
Oh, and max clock rate for the ADC is 1MHz at 3v
Regards,
Alec
Post Edited (Basil) : 3/29/2007 1:03:00 AM GMT
128K? I thought there was a 1Mbit version? It has write cycle times of 5ms which seems to be standard. Ill be writing approx 5bytes of data at a time i'd say.
Time 16bits (2 bytes)
Accel. Raw 12bits (1.5 bytes)
Barr. Raw 12bits (1.5 bytes)
I'd like to be able to write all the calcuated values too but that could take it up to much time. (approx 20bytes)
You can write up to a page of data in one 5ms cycle. The larger EEPROMs have a page size of either 128 or 256 bytes. You could write a whole packet (maybe 32 bytes) of data in one 5ms cycle.
Oh! bit and bytes... quite a difference
Thanks for the clarification on the page thing