Go Down

Topic: Help using PIC? (Read 2 times) previous topic - next topic

Nick Gammon

You can use the Uno as an SPI programmer, yes. There are tutorial pages about that (Arduino as ISP) and the relevant sketch comes with the Arduino.

You can log to EEPROM, of which you have 1 Kb on the Atmega328. Simple arithmetic should show whether you have enough of that to store the amount of data you have in mind.
http://www.gammon.com.au/electronics

mrShrimp

Huh, I was under the impression that flash memory was another type of EEPROM.  I am pretty sure 32Kb will be enough, but 1Kb certainly won't be.  This is where I got that info (I am not sure of the site's reliability): http://www.seattlerobotics.org/encoder/sep97/basics.html

tuxduino

Quote
I was under the impression that flash memory was another type of EEPROM.


Technically, flash rom is another type of "electrically erasable" rom, but this doesn't tell us how it can or can't be used in practice :-)

Flash ROM is where the program code is stored. EEPROM is the user-accessible one. So basically yes, you just have 1KB to store data. To increase that you have to go the sd route or add an external (i2c ?) eeprom chip.

westfw

Quote
I was under the impression that flash memory was another type of EEPROM

Yes, and no.  The 32k of "flash program memory" in an ATmega328 is not usable for writing data, and has a limited number of cycles when being written by anything.  The EEPROM is much more easily writable, but is only 1k.  An SD card offers ridiculous amounts of storage, at the expense of complexity (a filesystem and whatnot.)  (If you use the arduino environment, a lot of that complexity may be hidden by pre-written libraries.)  In between, you can find external serial EEPROM and "Dataflash" chips that have intermediate amounts of storage, and intermediate complexity...

Far-seeker


Quote
I was under the impression that flash memory was another type of EEPROM

Yes, and no.  The 32k of "flash program memory" in an ATmega328 is not usable for writing data, and has a limited number of cycles when being written by anything.


Technically both the Flash and the EEPROM have a limited amount of write/erase cycles, though in the AVR chips used in Arduinos there is at least an order of magnitude difference (i.e. a factor of ten) in the minimum times a memory space can be rewritten in EEPROM.  For example in Section 7, "AVR Memories", of the ATmega328 datasheet it states; "The Flash memory has an endurance of at least 10,000 write/erase cycles" and "The EEPROM has an endurance of at least 100,000 write/erase cycles".  

mrShrimp

Ok, it seems like I will have to use an SD card.  I definitely do not trust myself to make this from scratch, so would I be able to start with something like this: http://www.adafruit.com/products/254, and interface it to a standalone ATmega328?

Far-seeker


Ok, it seems like I will have to use an SD card.  I definitely do not trust myself to make this from scratch, so would I be able to start with something like this: http://www.adafruit.com/products/254, and interface it to a standalone ATmega328?


Yes and the tutorials and example available from Adafruit are usually a worthwhile read, the only thing to keep in mind is you won't have the luxuary of labeled headers.  If you go the standalone ATmega328 route, save yourself some time and effort and get one with the Arduino bootloader pre-installed.  Unless of course you want to learn how to use ICSP to either load the Arduino bootloader on a blank chip or program the ATmega328 using a different programming tool chain than the Arduino IDE.

Nick Gammon


Ok, it seems like I will have to use an SD card.  I definitely do not trust myself to make this from scratch, so would I be able to start with something like this: http://www.adafruit.com/products/254, and interface it to a standalone ATmega328?


Yep, I have one of those and it is easy to interface. You just need 6 wires: +5V/Gnd and the other four go to D10 to D13 on the Uno (which is pins 16 to 19 on the Atmega328 chip itself).
http://www.gammon.com.au/electronics

mrShrimp

Sorry for bumping this thread, but I just want to thank you all for helping a newbie like myself!  This project means a lot to me, and this is one of the most helpful/active forums I have seen!  Hopefully this works!

kf2qd

You can buy an ATMega328P WITH BOOTLOADER as an easy way to program an Arduino chip for use in another circuit. I have seen the chip with bootloader for $3.00US - $6.00US. IF your Arduino board has the DIP type processor in a socket it is real easy to remove the chip (make sure you note how the original was inserted) and plug the new one in the same way. Make sure power is off when you swap them. You can then program the new chip and then swap them back.

OR - you can use the ArduinoISP sketch and put your AYMega328P in a breadboard with power, some bypass caps and a crystal/resonator or on your own board and hook it up properly to your Arduino and program the chip directly. It might be easier to program your chip that way because it might be easier and lighter to solder it into your HAP payload.

Go Up