Hello,
I am having problems with SRAM_23LC library. I have a 23LCV1024 IC, everything is hooked up correctly. I am using a Adafruit Metro M0 Express(SAMD21). Heres a link to library: GitHub - mattairtech/SRAM_23LC: Driver for Microchip Technology Inc. 23LC (23LCV) SPI SRAM chips for AVR, SAM3X (Due), and SAM M0+ (SAMD, SAML, SAMC) microcontrollers on the Arduino platform.
Pin 13:SCK
Pin 12: SO
Pin 11: SI
Pin10: CS/SS
I sent a simple block of code, all I want to do is write a byte to a certain address and then read from the address to make sure I did it correctly. But every-time I write to it, it returns a 0.
I attached the code.Any help would be great.
#include <SPI.h>
#include <SRAM_23LC.h>
// SPI bus can be SPI, SPI1 (if present), etc.
#define SPI_PERIPHERAL SPI
#define CHIP_SELECT_PIN 10
SRAM_23LC SRAM(&SPI_PERIPHERAL, CHIP_SELECT_PIN, SRAM_23LCV1024);
/
byte tbyte;
uint32_t address = 250;
uint8_t ubyte = 0x01;
void setup(void)
{
SRAM.begin();
Serial.begin(9600);
delay(1000);
//write 1 to specified address,ubyte= 1
size_t ret = SRAM.writeByte(address, ubyte);
}
void loop(void) {
//read address,should give a 1 if written to it correctly
tbyte = SRAM.readByte(address);
Serial.println("ubyte =");
Serial.println(ubyte);
Serial.println("tbyte =");
Serial.println(tbyte);
Serial.println("address =");
Serial.println(address);
}