Code Monkey home page Code Monkey logo

adafruit_fram_spi's Introduction

Adafruit SPI FRAM Driver Build StatusDocumentation

This driver is for the Adafruit SPI FRAM Breakout

About this Driver

These modules use SPI to communicate, 4 pins are required to interface.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Kevin (KTOWN) Townsend for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution

To install, use the Arduino Library Manager and search for 'Adafruit FRAM SPI' and install the library. The "Adafruit BusIO" library is also required

adafruit_fram_spi's People

Contributors

alba-ado avatar andydoro avatar deanm1278 avatar driverblock avatar ericbieri avatar evaherrada avatar hathach avatar hoffmannjan avatar ladyada avatar lwestfall avatar maltep avatar microbuilder avatar mikeaustin avatar pepijndevos avatar pholmes2012 avatar spirit532 avatar tdicola avatar tyeth avatar xfacthd avatar yilungao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_fram_spi's Issues

Adafruit_FRAM_SPI rel.2.4.1 error: invalid conversion from 'const uint8_t*' to 'uint8_t*'

Hi all, using Arduino IDE 1.8.20 (NOT relevant) on Win10 (NOT relevant), selecting ESP32,
Tools setting ==> Primary Debug Level: "Verbose", using this code (just the minimum to reproduce the problem):

// Adafruit_FRAM_SPI library version 2.4.1
#include <Adafruit_FRAM_SPI.h>

// instantiate the SPI library defining the used SPI pins
// HSPI ==> SCLK=14, MISO=12, MOSI=13, CS=15)
Adafruit_FRAM_SPI myFRAM = Adafruit_FRAM_SPI(14, 12, 13, 15);

void setup() {
// put your setup code here, to run once:
myFRAM.begin();
//
}

void loop() {
// put your main code here, to run repeatedly:
}

On Serial Monitor I am notified:
Adafruit_FRAM_SPI.cpp:220:18: error: invalid conversion from 'const uint8_t*' {aka 'const unsigned char*'} to 'uint8_t*' {aka 'unsigned char*'} [-fpermissive]
Adafruit_SPIDevice.h:80:23: note: initializing argument 1 of 'bool Adafruit_SPIDevice::write(uint8_t*, size_t, uint8_t*, size_t)'

Obviously, after removing that -const- from the two files, the whole thing is compiled without errors / warnings.

write method const pointer argument

void write(uint32_t addr, uint8_t *values, size_t count);

Similar to this issue it would be nice if the write method takes const uint8_t* instead of uint8_t*. i.e.
changing the method to
void write(uint32_t addr, const uint8_t *values, size_t count);

The underlying method SPIClass::transferBytes also takes const uint8_t*.

I understand this would require changing the code in the Adafruit_BusIO library as well but given Adafruit_I2CDevice write() already takes const pointers, it would be nice to be consistent and fix the Adafruit_SPIDevice as well.

Can submit a PR if that works.

Fujitsu FRAM does not appear to support multi-byte sequential writes

Screen Shot 2021-07-11 at 02 23 52

- Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE**

STM32 Nucleo H743Zi2.

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

PlatformIO.

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

When doing a multi-byte sequential write, some chips (Cypress for example) auto-increment and writes the bytes in order to sequential memory addresses. Fujitsu's chip does not appear to have this functionality, requiring some sort of additional CS signalling to allow increments. Without the special signaling, only the first byte is written.

int multiplication results in overflow

Hello,

On the ATmega boards (Uno, etc) these multiplications are evaluated as 16-bit int multiplication which results in an overflow. Appending L to either of the operands will evaluate these as longs, which fixes the issue for these boards. I can submit a PR if you'd like.

{0x04, 0x2503, 32 * 1024}, // MB85RS256TY
{0x04, 0x4803, 256 * 1024}, // MB85RS2MTA
{0x04, 0x4903, 512 * 1024}, // MB85RS4MT
// Cypress
{0x7F, 0x7F7f, 32 * 1024}, // FM25V02

Compilation error on SAMD51 boards related to SPI clock divider

  • Arduino board: Adafruit (ItsyBitsy/Feather/Metro/Trellis) M4

  • Arduino IDE version: Arduino IDE 1.8.5

  • Steps to reproduce the problem:

#include <Adafruit_FRAM_SPI.h>
void setup() {}
void loop() {}

Compiling these three lines for any SAMD51 based board from Adafruit causes a compilation error in the begin() function on line 97 where the clock divider is set.
Looking at the error

Adafruit_FRAM_SPI.cpp:97:23: error: SPI_CLOCK_DIV2 was not declared in this scope
SPI.setClockDivider (SPI_CLOCK_DIV2); // 8 MHz

leads me to believe that the SAMD51 boards are completely missing the SPI clock divider defines.

If you would prefer to handle this issue over on your Arduino_SAMD repo, I will move it there.

Address range.

I have modified an Adafruit FRAM SPI breakout board to use a 4Mbit FRAM chip and found two issues with this driver.

  1. The default maunufacture ID is 0x7f and default product ID is 0x7f7f so fails obviously.

  2. The read and write functions take only a 16bit address, 24bit addresses are required for > 64K chips.

I have modified this driver locally and everything works up to the full 512K.

I realise you are probably not interested in supporting modified boards, which covers point 1, but will you be addressing point 2 in the near future?

Extended SPI

As I understand by reading through the CPP there is no provision for the extended SPI library, correct?
How do I work with other SPI hardware with different datamodes?
Note I use a DUE board.

getting a low power mode?

The datasheet mentions the existence of a low power sleep mode. Any hope that the power modes switching may be added? :)

Increased logging speed

I’ve been using the library for some time now, and it works very well. Thanks for that.

Using an Arduino Uno, I’ve been able to log 100bytes in 8’332 microseconds and using a Teensy 3.5 I’ve logged 100bytes in 3’342 microseconds, which is fine for most applications.

I would like to suggest an improvement to increase the logging speed.
The fram.write8(uint16_t framAddr, uint8_t value) fonction writes 3 bytes (2 for the address and 1 for the actual value) each time I want to store 1 byte of data.

In my example, to log 100 bytes, I would need to send 200 additional bytes just to indicate the address. This causes the logging speed to be much slower than what it could be.

Could you add a feature that bumps X amount of bytes in row, starting at a user defined address and then automatically increment the address until X amount of bytes are saved ?
Sort of like : fram.write8(uint16_t framAddr, uint8_t *value, sizeof(value))

Reply #15 of this post shows what I mean : https://forum.arduino.cc/index.php?topic=719031.0

Thanks for your help.

ATSAMD51 hardware SPI not working

Hi, I've been recently working with the ATSAMD51 and come to test it with some FRAM. However, it seems like the hardware spi mode has some issues.

  • Arduino board: ItsyBitsy M4 (SAMD51)

  • Arduino IDE version: 1.8.11 (latest)

  • Reproduce the problem:

Load the example info sketch. Using "hardware spi" the samd seems to freeze and does not open any serial connections. If you use the "software spi" with manual pins it seems to work. At least I'm getting serial connections again. Compilation is successfull in both cases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.