Electronics > Projects, Designs, and Technical Stuff

Where to put the data?

(1/4) > >>

sgpee:
Fellow masters,

here is a rookie, asking probably a stupid question.

- I have a system that generates data, roughly 60KB/sec (coming from peripherals, industrial application)
- I need to ship this data to a PC using USB.
- For some reason, I need to align this data in my MCU every second to a correct format, add time stamps etc. before ship out to PC.

Now, the MCU I am using has only 8KB of memory, ideally, I would have written all data to RAM and fiddle with it and than ship to USB buffers and problem solved, however not in this case since I have a tiny RAM. (Or change PC software to fix this, however PC software is legacy and customer is not interested in me fiddling with PC).

I have some flash memory available that I can use as a circular buffer to write and read etc, however I find this not very elegant as I am afraid to miss data during this long arduous write operation as the data keeps coming. Now, I am considering couple of options and I wanted to get some ideas:

- Use SPI ram 1Mbit or so: There is a problem here as I use two available SPI ports to collect data from peripherals. If I multiplex the SPI, I am afraid I may loose data. (Even a  single bit should not be lost, the peripheral just puts data to fifo, if you run the fifo, data is gone). Question: How do I calculate whether I run out of BW and loose data here?

-  Use a second processor: Dedicate this one for data collection. Choose this one wisely. Size is a concern here and I cannot tolarate 60-70pins, need to be tiny and a lot of ram etc. Couldn't find one yet?


Anyway, hope you guys could offer some help.

Cheers, sgpee

alm:

--- Quote from: sgpee on November 22, 2010, 10:15:37 am ---Now, the MCU I am using has only 8KB of memory, ideally, I would have written all data to RAM and fiddle with it and than ship to USB buffers and problem solved, however not in this case since I have a tiny RAM. (Or change PC software to fix this, however PC software is legacy and customer is not interested in me fiddling with PC).

--- End quote ---
Can you modify the algorithm to be streaming (i.e. process every 'record' as it comes in, not wait for a full second of data)? Otherwise, the cheapest and simplest solution would probably to change to an MCU with plenty of RAM, it's not like that's expensive. It sounds like you have to modify the software and board layout anyway.


--- Quote from: sgpee on November 22, 2010, 10:15:37 am ---- Use SPI ram 1Mbit or so: There is a problem here as I use two available SPI ports to collect data from peripherals. If I multiplex the SPI, I am afraid I may loose data. (Even a  single bit should not be lost, the peripheral just puts data to fifo, if you run the fifo, data is gone). Question: How do I calculate whether I run out of BW and loose data here?

--- End quote ---
Can your FIFO's run at a higher SPI clock, or are they limited to 60k*8 Hz or so? How long until your FIFO overruns? Can you ship the data in and out during this time at the highest clock rate the devices allow?


--- Quote from: sgpee on November 22, 2010, 10:15:37 am ----  Use a second processor: Dedicate this one for data collection. Choose this one wisely. Size is a concern here and I cannot tolarate 60-70pins, need to be tiny and a lot of ram etc. Couldn't find one yet?

--- End quote ---
I'd look into an ARM Cortex M3 controller (eg. NXP LPC1xxx, or ST M32). Getting these with some horse power/RAM is usually cheaper than getting a top-of-the-line 8-bit MCU. Use some tiny TQFP package if size is an issue. However, I'd look into replacing the first processor before adding a second, since two processors would increase complexity, and it shouldn't be an issue to do this with one (appropriate) MCU.

Psi:
It does sound like you're expecting a bit much from what sounds like an 8bit mcu with 8KB sram.

There is the storage issue with trying to handle 60KB/s data with only 8KB of ram but also 60KB/s is 480,000 bits a second, so your data is coming in at around half a million bits per second.
Even if your 8bit mcu was running at 20MHz (depending on mcu type and instructions per clock cycle) your only going to get
something like 10 -> 40 cpu instructions per bit of data.

Of course you can load an entire 8bit port of data in one instruction if your I/O is matched nicely between the mcu and external sensors and doesnt need to be bit merged back into useful variables in software.

And on top of that you need to convert the data format and add time stamps.

mikeselectricstuff:

--- Quote ---Use SPI ram 1Mbit or so: There is a problem here as I use two available SPI ports to collect data from peripherals. If I multiplex the SPI, I am afraid I may loose data. (Even a  single bit should not be lost, the peripheral just puts data to fifo, if you run the fifo, data is gone).
--- End quote ---
It's trivially easy to do SPI on normal IO ports - much easier than sharing a hardware SPI.

Zad:
If you have to stay with that micro, stream it to a big cheap SD card over serial. I would be going the ARM/Cortex method though, it will be cheaper and faster all round.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod