chipKIT® Development Platform

Inspired by Arduino™

doubts with Max32 flash memory

Created Tue, 15 May 2012 15:01:53 +0000 by pablo


pablo

Tue, 15 May 2012 15:01:53 +0000

I'm starting a project where I need to activate 64 outputs (fish feeders) depending on the time. You can configure till 12 alarms per day to feed. So my aim is to be able to register 12 alarms x 7 days(in a week) x 64 feeders in the flash memory. How could I do it? I've read that Eeprom is not big enough and I don't want my data to be erase if the power goes off. The way my code has to work is: Every 20ms, it has to check out if the time in the RTCC matches the time in those alarms. In case it does, feeders will be activated.

Thank you


EmbeddedMan

Wed, 16 May 2012 02:57:09 +0000

Pablo,

I'd add a serial EEEPOM - either I2C or SPI. They are super cheap, and you can easily store plenty of your alarms and setpoints and such. Yes, you can use other parts of the Max32's flash for storing these things, but it has a limited number of erase cycles (not a problem with serial EEPROM) and is more difficult to manage.

*Brian


WestfW

Thu, 17 May 2012 05:29:37 +0000

12 alarms * 64 feeders * 7 days == 5376 entries. If you were to use 16 bits for the time of day (dividing the day into 65536 intervals, each about 1.3 seconds long (make it 2 seconds, and it'll still fit fine), this would consume less than one tenth of the 128k available flash memory on the smaller chipkit.

I don't think that that should be much of a problem! You don't really need 20ms accuracy for food deployment, do you?

(I've been contemplating this sort of thing for a long time, as I swear at my home irrigation controller and all the awful conniptions it puts me through, presumably due to its designers' desire to fit N valves of "schedule" into the 256 bytes of RAM (volatile!) available on an 8051-class CPU. It's SO 80s. (and probably dates to the 80s as well. But the newer controllers seem to have kept similar brain-dead user interfaces for the sake of backward compatibility, or something. Sigh.)

Or as EmbeddedMan points out, "external storage" is huge and cheap. Put everything on a micro-SD card, and you can use most of the 2G (minimum size you're likely to find) for ... something else. Even with woefully inefficient data structures.


les1943

Thu, 17 May 2012 09:02:09 +0000

I have used UNO for my greenhouse watering timer ( similar concept) with an EEPROM to store a program of frequency, watering period and active window, UNO Alarm output from RTC is fed back into a pin to provide an pin interrupt every 2 seconds (forever) (I did not know how to use RTC internal interrupts ) UNO sends program / time changes and monitors a remote PIC16F1828 (.asm proged ) it controls the water pump and records temperature , humidity and keeps time, also gives level of 12v battery a 443Mhz transceiver provides a serial remote link 20 Bytes every minute, a serial lcd shows the data at the UNO, I plan to have history file on the EEPROM, This has been my first C++ so big learning curve....

Re the 64 feeders if MAX short on ports you could use I2C port expanders like MCP23008 and put 8 + EEPROM on one link....


pablo

Thu, 17 May 2012 11:00:52 +0000

Thank you so much for your answers.

@Brian. I read I can use till 32 kb more or less of flash memory, but as you said it has a limited number of erased cycles. I had no idea it was more difficult to manage :S.

@WestfW. Although I agree with you, I need 20ms accuracy.

I have used UNO for my greenhouse watering timer ( similar concept) with an EEPROM

I'm happy to hear this. I'd appreciate all the info you could share about it because it can help me a lot.

So, now I have to look for an external serial EEPROM. Do you recommend me any particular one? SPI is faster than I2C, isn't it? IS Eeprom better/easier to program than sd or micro-sd storage?


EmbeddedMan

Thu, 17 May 2012 15:46:55 +0000

The best thing to do is to try and use an existing library, I would say.

For example, this one [url]http://arduino.cc/forum/index.php/topic,63655.0.html[/url] looks like it talks to SPI based EEPROMs. (I like SPI a lot more than I2C. Much harder to mess up.)

Looks like this part [url]http://www.mouser.com/ProductDetail/Microchip-Technology/25AA256-I-P/?qs=sGAEpiMZZMuVhdAcoizlRQmfcE3zL6VtaRPJnBU30sc%3d [/url] will work with the library.

*Brian


les1943

Fri, 18 May 2012 09:13:27 +0000

Im using 24LC256 and started by running the EEPROM Sketch from the MPIDE examples , then modified the routines to suit . dont forget the pull up resistors on clock and data , between 2K and 10k depending on speed you can put up to 8 on one link or use 24LC512