Go Down

Topic: Adafruit SPI FRAM help (Read 511 times) previous topic - next topic

dauntless89

Hey guys,

I'm trying to use an Adafruit SPI FRAM with my Due project and I'm having a hard time understanding how to use it. I'm not trying to do anything fancy, just reading and writing 32-bit values.

I've looked through the library files (found here) and I see that the read and write functions use arrays of 8-bit values, but I can't tell if it automagically breaks the 32-bit value apart and then puts it back together when read, or if it's just writing & reading a series of separate 8-bit values.

This is outside the scope of the example code, and the Adafruit tutorial covers basically the bare minimum to get the chip working. I haven't found anything else through searching. If anyone can shed some light or point me towards a better resource, I'd appreciate it. Thanks.

ard_newbie

it's just writing & reading a series of separate 8-bit values. Yes

dauntless89

Alright. So... it looks like I have no choice by to use unions to get my 32-bit datatypes in and out of EEPROM in this case? I might accomplish that by incorporating it into new "fram.write32" and "fram.read32" functions in the library to keep my code clean.

One more question, does the memory addressing have to be in base-16, or can it be base-10?

Thanks.

ard_newbie

#3
Mar 23, 2018, 01:56 pm Last Edit: Mar 23, 2018, 01:58 pm by ard_newbie
does the memory addressing have to be in base-16, or can it be base-10?
Why the 64 Kbits memory of the SPI FRAM should be addressed in base-16 (or I don't understand your question)?

You should read carefully the .pdf provided here about this device:

https://learn.adafruit.com/adafruit-spi-fram-breakout/overview

dauntless89

Because the example code is full of base-16... see page 14. Base-16 locations and values. That section is the only place the term "location" is used. "address" only appears two times on page 15.

Neither describes what "address" is supposed to be, other than a variable. I have not been able to find examples of other people's project code to see what they are doing.

ard_newbie


Page 14: They show memory locations (bytes) in rows, each row contains 16 bytes, and nothing more !

Now, if you want to address any memory location (i.e. Byte) to write a Byte, your code will be (page 14):

fram.writeEnable(true);
fram.write8(address, byte-value); // 0<= address <= 8 * 1024 Bytes
fram.writeEnable(false);
to write an 8-bit value to the address location

What is the issue with that ?

mlucas

Hey guys,

I'm trying to use an Adafruit SPI FRAM with my Due project and I'm having a hard time understanding how to use it. I'm not trying to do anything fancy, just reading and writing 32-bit values.

I've looked through the library files (found here) and I see that the read and write functions use arrays of 8-bit values, but I can't tell if it automagically breaks the 32-bit value apart and then puts it back together when read, or if it's just writing & reading a series of separate 8-bit values.

This is outside the scope of the example code, and the Adafruit tutorial covers basically the bare minimum to get the chip working. I haven't found anything else through searching. If anyone can shed some light or point me towards a better resource, I'd appreciate it. Thanks.
I just asked a question about wiring up the same FRAM on a DUE.  Can you tell me how you connected the FRAM to your DUE?  Did you use the SPI connector close to the CPU?  Which pin did you use for the FRAM's CS connection?

Thank you,
Michael

Go Up