Hi
I want to store some data to a 23lc1024 Sram but I am having trouble.
I have tried 4 or 5 different Sram Libraries and they all fail. The DUE hangs/stops at statup.
//************* code example *************
#include <SPI.h>
#include <SpiRam_Extended.h>
#define SS_PIN 10
SpiRAM SpiRam(SPI_CLOCK_DIV4, SS_PIN, CHIP_23LC1024); //DUE hangs/stops here.
void setup() {
Serial.begin(115200);
}
void loop()
{
char data_to_chip[17] = "Testing 90123456";
char data_from_chip[17] = " ";
int i = 0;
// Write some data to RAM
SpiRam.write_stream(SPI_CLOCK_DIV4, data_to_chip, 16);
delay(100);
// Read it back to a different buffer
SpiRam.read_stream(SPI_CLOCK_DIV4, data_from_chip, 16);
// Write it to the serial port
for (i = 0; i < 16; i++) {
Serial.print(data_from_chip*);*
- }*
- Serial.print("\n");*
- delay(1000); // wait for a second*
}
//************* code example finish *************
I have tried changing the SPI clock divider to 21 84mhz/21 = 4mhz.
Tried changing CS pin to 4, 10, 52, 8.....
If I remove initCb(); from SPI.cpp / init() function the due will not hang but SPI Sram wont work (see below).
void SPIClass::init() { - if (initialized)*
- return;*
- interruptMode = 0;*
- interruptSave = 0;*
- interruptMask[0] = 0;*
- interruptMask[1] = 0;*
- interruptMask[2] = 0;*
- interruptMask[3] = 0;*
_ initCb(); // ****** comment out this line *******_ - SPI_Configure(spi, id, SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS);*
- SPI_Enable(spi);*
- initialized = true;*
}
Does anyone have any suggestions?
Thanks for any help.
Almec