I'm currently using an ItsyBitsy 32u4 for keyboard macros over USB. It works great!
My current process to update the macros is to update them in the code and reflash the device. Is it possible to instead use part of the 28KB of onboard flash for arbitrary storage? I would love to be able to create a small tool that talks to the 32u4 over serial to update just the macros. This would also make it feasible to create the same device for friends who would feel overwhelmed having to update their macros using an IDE.
If this is possible, some direction for how to work with storage in C++ would be awesome.
32u4: Code-accessible Storage?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: 32u4: Code-accessible Storage?
Unfortunately the ATmega32u4 can't write to its Flash memory from normal code. Only the bootloader can do that.
The ATmega32u4 has 1k of internal EEPROM that you can read and write from normal code.
If you want to stay with the ATmega32u4, it will probably be easiest to use some kind of external storage.. a micro-SD card would be simplest, though you'd only use a fraction of the storage and the cost would be relatively high.
If you need more space than that, the least expensive option would probably be an I2C EEPROM. You can get 32kbit chips (4k of storage) for 25c in lots of 100. If you put the chip on a removeable carrier,
If you're willing to switch to a 32-bit microcontroller, all of our M0 boards can read and write the Flash array from normal code. They also have a larger Flash array, so you can store more information. If you really want memory, our Express boards have a built-in 2MB external Flash chip.
The ATmega32u4 has 1k of internal EEPROM that you can read and write from normal code.
If you want to stay with the ATmega32u4, it will probably be easiest to use some kind of external storage.. a micro-SD card would be simplest, though you'd only use a fraction of the storage and the cost would be relatively high.
If you need more space than that, the least expensive option would probably be an I2C EEPROM. You can get 32kbit chips (4k of storage) for 25c in lots of 100. If you put the chip on a removeable carrier,
If you're willing to switch to a 32-bit microcontroller, all of our M0 boards can read and write the Flash array from normal code. They also have a larger Flash array, so you can store more information. If you really want memory, our Express boards have a built-in 2MB external Flash chip.
- jason_mf
- Posts: 2
- Joined: Sat Jul 04, 2020 4:25 pm
Re: 32u4: Code-accessible Storage?
For my purposes, being able to write to the 1Kb of EEPROM would be totally sufficient, even if it's slow since updating the macros would be infrequent. Is there a C++ library or other reference you can point me to?
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Please be positive and constructive with your questions and comments.