External memory question
Hi,
I would like to ask a couple of questions about the possibility to use an external RAM.
I am planning to use the GPS module to have speed calculated with a moving average over a few minutes.
In order to do that I was thinking of calculating distance and time interval between samples, accumulate the values in two working variables, and store the sampled data in RAM.
When I add another sample, I subtract the oldest, and update the average speed.
To do that I have to store all my samples in RAM.
Is there a bettere way? What kind of external memory should I use?
Thanks in advance,
Massimo
I would like to ask a couple of questions about the possibility to use an external RAM.
I am planning to use the GPS module to have speed calculated with a moving average over a few minutes.
In order to do that I was thinking of calculating distance and time interval between samples, accumulate the values in two working variables, and store the sampled data in RAM.
When I add another sample, I subtract the oldest, and update the average speed.
To do that I have to store all my samples in RAM.
Is there a bettere way? What kind of external memory should I use?
Thanks in advance,
Massimo
Comments
The SX48 has about twice the RAM of the SX28, maybe that would work.
Otherwise, the only external RAM I have used is a 32KB chip with the SX48. It needs alot of I/O pins.
If you look at the schematic for the Javelin you can see how the external RAM is connected.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
Would it be possible to use a I2C sram like the PCF8570 from NPX?
http://www.nxp.com
I have to decide how long I would sample and the data format, so maybe it would be enough to use the internal RAM.
Massimo
features 32KB ram (300mil or 600mil wide), eeprom, rs232.
If I recall correctly this used ports A, D and E for onboard
features. Ports B and C and the RS232 signals where available
at the 0.1" 2x17 pin header.
I could dig up the schematics and code but that would take a while
because I am currently migrating to a new pc. The picture
was grapped from my camera.
regards peter
Thanks,
Massimo
The addon pcb has pin headers that go into the socket headers.
regards peter
Correct me if I'm wrong.·
regards peter
Robert
PM me if·you're interested.
regards peter
By using 2 latch ic's only 12 I/O lines are required to
interface the external ram. So you could use that schematic
to add external ram to sx18/ss20 or sx28 as well.
Originally this board was to be my entry for the sx design contest
2006/2007 using the CSC sx/c compiler, but CSC never got
the compiler to work and so I had to cancel my entry.
regards peter
You can filter the data with much less memory with a recursive filter.· The filter is as follows:
Y(i) = A*X(i) + (1-A)*Y(i-1)
X(i) is the current sample, Y(i-1) is the previous filter output, and Y(i) is the current filter output. The value of "A" is less than one, and it depends on how much filtering you want.· It seems like for your application,·"A" would have a value of 0.01 ot 0.005.
Your computations need to be done with a bit more precision than the input data, otherwise you will lose precsion on the results.· If the input data is 16 bits, the intermediate results should probably be 24 bits.
Dave
I tested the formula but I have troubles with it.
I had in mind a formula like the one in
http://en.wikipedia.org/wiki/Moving_average
If I test in a spreadsheet random data with a moving average and your filter I cannot get the same values.
If the data are slowly varying the difference is smaller, or if the samples increase, nontheless the results are different.
Moreover your algorithm could be a problem if my samples are not equally spaced (with a GPS loosing the fixing a couple of seconds).
Could you confirm it or am I missing you point?
Thanks,
Massimo
There are pros and cons to both filters.· The moving average filter has a finite impulse response, and it is easy to implement.· The simple recursive filter has an infinite impulse response.· However, it requires less memory.· The results will be different between the two filters.· For your application I don't think the difference is important.· You just want to smooth out the velocity measurements.· If you required a specific frequency response, then you would need either a more complicated recursive filter or a more general finitie impulse response (FIR) filter.
The recursive filter can be implemented without multiplications if you use powers of two.· With a filter coefficient of 1/128, the previous filter value be reduce by 127/128 and the new input value would be multiplied by 1/128.· This would be done by shifting the previous value down by 7 bits, and subtracting it from the unshifted value to scale it by 127/128.· The new input value would be shifted down by 7 bits to scale it by 1/128.
The effect of irregular time intervals will be about the same for both filters, so that doesn't really make much difference.
Dave
now it is much clearer.
Thank you for the explanations.
Massimo
This should allow multiple MCU's to access·the
same ram chip (shared ram).
The protocol used for arbitation is I2C-like using signals
CPL and CPH. This only works with 74HC(T)373 latches
because these·are transparent while their LE input·is high.
Please comment on the proposed protocol if you
think there is a better way.
regards peter