Boron and SPI difficulties

I am trying to meld an Adafruit library for Fram and SPI on the boron. What are the defaults for the boron SPI clock, divider, datamode, bitorder, etc? If I use the Adafruit library do I still need to include the SPI.begin() and all the other SPI settings.

Which FRAM chip, which library, and do you have other things on the same SPI bus?

Ideally you should always set the correct parameters using SPI transactions rather than relying on the defaults because another library using the same bus may change the SPI parameters like speed, data mode, and bit order. Some libraries use SPI transactions, some do not. Also using SPI transactions is important if you are sharing the SPI bus with the system, but this only occurs if you are using Ethernet.

Normally the library will call SPI.begin() for you, but if it does not, then your code would have to call it. At least one thing needs to enable SPI, or the pins are used as GPIO, not SPI.

1 Like

Thanks for the reply. I am looking to have 3 of these FRAM chips on the SPI bus. The library I am using is adafruit_fram_spi. The adafruit library works and I can “see” the chip. This is without specifying anything in my code. However, the behaviour of the chip is super unstable. Sometimes it will read, sometimes it won’t. If I have more than one on the bus, they do not work. From what I can tell the timing is set to 1 MHz, the MSBfirst is the default, and data mode is 0.

How are you initializing the library? You need a separate Adafruit_FRAM_SPI object for each chip, and each one has to have their own separate CS pin configured as the first parameter to the constructor.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.