View previous topic :: View next topic |
Author |
Message |
davidbue
Joined: 05 Nov 2007 Posts: 28 Location: Denmark
|
A simple way to make datalogging in the kilobyte range. |
Posted: Wed Oct 29, 2008 2:40 am |
|
|
Hello everybody!
I need some of you code gurus to help me design my datalogging interface.
It's for an eco-car at our university, that runs more than 300 km/l = 706 miles per gallon fuel-equivalent to gasoline. Being a student of mechanical engineering, (with micro-controllers as a small hobby of mine), I'm on deep water with this one.
I need to log 6 x 16bit integers every second, for an hour. That must run up to 60*60*16*6 = 345 600 bytes -> roughly 350 kb of data right?
That's WAY more that I can store on my internal eeprom on the pic18f2220 that I use, so I must look around for some external storage media.
I was looking at CompactFlash cards, but it seems to be overkill for this job, and It's waaaay to complicated for me :-)
Any suggestions on an easier, simpler, and less complicated way to do the job. I kinda hope that there is some small external RAM module that I can write to, pretty much the same way as with the internal eeprom, and that there is some wirering + code examples out there!
Any help is greatly appreciated.
Have a really nice day!
David |
|
|
treanla Guest
|
Serial flash perhaps ? |
Posted: Wed Oct 29, 2008 3:24 am |
|
|
Take a look at Winbonds Serial flash range. Simple SPI interface and available in large sizes.
Maybe that could do the trick for you. |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Wed Oct 29, 2008 3:36 am |
|
|
Your calculation is wrong.
16 bit int = 2 bytes so 60 (min) * 60 (sec) * 6 (ints) * 2(bytes) = 43200 Bytes. (~43KB)
A lot smaller than your value |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Wed Oct 29, 2008 3:38 am |
|
|
Haha, Wayne
Nicely caught! I completely missed that!
Rohit |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Wed Oct 29, 2008 6:45 am |
|
|
You might try Ramtron Serial FRAM memory. They have no delays for writes
like regular EEProm does and handle a lot more write cycles. I have used a lot of these and they make writing
to external memory much faster....
http://www.ramtron.com/ |
|
|
Guest
|
|
Posted: Wed Oct 29, 2008 8:38 am |
|
|
345,600 kbits = 43200KBytes.
I was looking at some of these winbond ICs, and if I understand their operation correctly, you have to write a full page at once. You cannot just write an arbitrary amount of data to them. Is the page size the sector size? If so, I don't see how most pics will be able to use these chips, as the sector size for all of these chips is 4KB. The original poster's chip only has 512 bytes of ram. So unless you are storing the data in program memory, how would this work?
Or am I just way off base? |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Wed Oct 29, 2008 8:49 am |
|
|
If money is not the issue but time is, throw a VDIP1 module at it. Plug in a USB FLASH drive and write a CSV file to it via serial from the PIC using printf(). Then you can unplug the FLASH drive, plug it into your laptop and have the data already in a file. VDIP1 is set up to talk to USB mass storage and HID devices, costs $24.50 in singles from Mouser or Digi-Key. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Wed Oct 29, 2008 11:25 am |
|
|
dyeatman wrote: | You might try Ramtron Serial FRAM memory. They have no delays for writes
like regular EEProm does and handle a lot more write cycles. I have used a lot of these and they make writing
to external memory much faster....
http://www.ramtron.com/ |
But in this case a standard multi-sourced EEPROM is more than good enough as the data rate and total storage requirement is low. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
treanla Guest
|
Comment to guest |
Posted: Thu Oct 30, 2008 3:27 am |
|
|
You do not have to program a whole page of 256 bytes at once with the winbonds spi flash.Look at the page program function in the datasheet. |
|
|
Guest
|
Re: Comment to guest |
Posted: Thu Oct 30, 2008 10:17 am |
|
|
treanla wrote: | You do not have to program a whole page of 256 bytes at once with the winbonds spi flash.Look at the page program function in the datasheet. |
So one page is 256 bytes. A program instruction can write up to 256 bytes in a previously erased page. So if you have 1000 pages, but only write 1 byte per program instruction, you can only store 1000 bytes, right? |
|
|
Ttelmah Guest
|
|
Posted: Thu Oct 30, 2008 10:33 am |
|
|
No.
The point is that you erase a whole page (256 bytes).
You can then write bytes to the whole of this page in any order you want to the individual bytes, without performing another erase (so long as you don't want to overwrite a byte already written). Once the page is full (256bytes written), you can then start on the next page.
However it really all doesn't matter for this application. As has been pointed out by a couple of other posters, the data size, and rate required, just isn't that high. you could use an ordinary EEPROM, and even at 4mSec/byte (most modern EEPROMs are faster than this), 6*2byte integers per second, is only going to take 48mSec/second to write. Not exactly a problem. The total data required, is small enough, to fit into a 512Mbit EEPROM. If you use one of the standard '512' parts with a 64byte page, you can just write 60 bytes every five seconds to the chip, starting on a 64byte boundary (ignoring the extra four bytes available), and perform a single write for the whole block. Quick, easy, and cheap.
Best Wishes |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Oct 30, 2008 10:37 am |
|
|
Flash devices generally erase to all 1s.
When writing, you can write without erase as long as you are converting a 1 to a zero or leaving it as a 1. If you need to change a bit from a 0 to a 1 you need to perform an erase.
An erase is usually performed on a block (256 bytes).
If you have 1000 blocks and erased the first block (256 bytes). you can then write 1 byte to each of the first 256 addresses without another erase. you can do this one byte at a time or several or all 256 bytes.
You can then usually change a byte in that block without erase if you follow the above rule. If you need to convert a bit from a zero to a 1 you have to erase the block and re-write the data.
You can usually erase the whole device in one go or individual blocks.
With some memory management you can optimise the writing of your data with minimal erases. |
|
|
davidbue
Joined: 05 Nov 2007 Posts: 28 Location: Denmark
|
Thank you!! |
Posted: Thu Oct 30, 2008 11:25 am |
|
|
Thank you everybody for all the responses. I'll look into the different approaches, and try to decide what to do!
Best reagards! |
|
|
johnjohn7188
Joined: 29 Oct 2008 Posts: 8 Location: Irvine, CA
|
|
Posted: Thu Oct 30, 2008 2:17 pm |
|
|
Why don't you look into NAND Flash? I've written code to drive NAND Flash with a PIC24H. It writes VERY fast and costs very little. You have to write PAGES and erase BLOCKS with NAND Flash. Just make sure you load all your data to RAM before writing it. Micron makes really good and cheap NAND Flash. |
|
|
|