Microcontroller SRAM, Sector size and MBED

A project log for Keychain USB password manager

Tired of remembering passwords, and unable to install a traditional password manager? This may be the device for you.

Sam PSam P 05/10/2016 at 19:480 Comments

I was worried this might happen. I've run into a situation where the Atmega32U4 microcontroller doesn't have enough memory for what I want to do with it.

The issue is that I want to control a serial flash memory IC which has a sector size of 4Kbyte. The microcontroller has 2.5Kbyte of SRAM to work in. To be able to program the flash I first have to read in an entire sector, erase that sector, then program in the new data along with the existing data. Obviously I can't do the read with 4Kbyte being greater than 2.5Kbyte.

I think the solution to this is either to use a flash memory IC with a smaller sector size, or switch to a removable SD card which have a sector size of 512bytes.

On an unrelated note I've been thinking about switching over to MBED as it's USB libraries are a lot easier to use. I think this issue is a perfect excuse to do so, and I already own an LPCXpresso LPC1347 board to get started with. As a bonus someone has already written a library that allows an SD card to be seen as a mass storage device, but which can also be accessed from the microcontroller itself.