Adding an EEPROM to a BastWAN

While I was able to use the SD card on my BastMobile’s Keyboard Featherwing, my other BastWAN devices don’t have an SD card, or an EEPROM. There was a plan to add Flash memory to the board but that was scrapped. So I went dumpster diving, almost literally, and dug up some EEPROMs I had from an old project. These ATMEL 24C512 chips came loose for most of them, but I have a few that came on breakout boards. So I’m thinking Pavel, Pablo and Simon could do with some storage for settings and whatnot.

Connected to the BastWAN
The DIP switches are used to set the address (0x50+ 1/2/3: 0 to 7)

I used to have a home-grown library to manage multiple EEPROM chips as a single storage, but in between computer crashes and upgrades, I seem to have lost it. Oops. So meanwhile I’m using the SparkFun External EEPROM library. However, since there’s no definition for the BastWAN in the library’s header. It says:

#pragma GCC error "This platform doesn't have a wire buffer size defined. Please contribute to this library!"

I went digging around. Wire.h uses RingBuffer.h. There the buffersize is defined as:

#define SERIAL_BUFFER_SIZE 64

So let’s do that. We need to add the following lines to the library around line 60:

#elif defined(_VARIANT_ELECTRONICCATS_BASTWAN_)
#define I2C_BUFFER_LENGTH_RX SERIAL_BUFFER_SIZE
#define I2C_BUFFER_LENGTH_TX SERIAL_BUFFER_SIZE
Say hi to the first page of the contents of the chip.

The code is pretty straightforward, using the library’s functions to read the memory’s contents, displaying a few 256-byte pages. As usual, the code is on GitHub.

One response to “Adding an EEPROM to a BastWAN”

  1. […] In the previous post we saw how to connect an EEPROM and dump its contents. Nice but not OVERLY useful. On the BastMobile, the BastWAN connected to a Keyboard Featherwing, I managed to get the SD card up and running, so my prefs are nicely saved onto the SD card. Let’s do the same for the Naked Cousins™. This will be kind of a live coding exercise – I haven’t written the code yet and will switch back and forth between this post draft and the Arduino IDE… 🙂 […]

Leave a comment