TinyCircuits Forum

General Category => General Discussion => Topic started by: César Bárcenas on October 05, 2021, 12:14:22 PM

Title: Problems writing to Flash memory
Post by: César Bárcenas on October 05, 2021, 12:14:22 PM
Hi everyone, I am currently using the "TinyCircuits TinyShield Flash Memory: Sketch Example" for arduino, but when compiling and loading it to the board it does not allow me to write to the flash memory.

This is the result I get on the serial monitor:

---------------------------------------------------------------
Initializing Flash Memory...

Using writeByte...
Write failed!
Using readByte...
The byte on page 2468 at position 78 is: 0
---------------------------------------------------------------

I have tried using the SPIFlash.h and SPIMemory.h libraries, but I keep getting the same error.

Does anyone have an idea what could be happening?

I would greatly appreciate your help!!

Greetings.  :)
Title: Re: Problems writing to Flash memory
Post by: lennevia on October 05, 2021, 04:51:44 PM
Hello,

I just tested the Flash example program with a TinyScreen+ and had no issue writing and reading the byte value of 8. Can you tell me what hardware you used?

Best,
Réna
Title: Re: Problems writing to Flash memory
Post by: César Bárcenas on October 06, 2021, 12:08:08 PM
Hello, thank you very much for answering Réna.

It's weird, maybe my flash memory is corrupted.

I am using an Arduino MKRZERO and I am connecting the pins of MISO, SCK, MOSI and 5 for the CS, in addition to the pins of VCC and GND.

But it just won't let me write any data.  :-\
Title: Re: Problems writing to Flash memory
Post by: Jason on October 07, 2021, 11:12:53 AM
Hi,

We don't have any Arduino MKRZERO boards to test the flash shield with.

I assume you are accessing the flash shield pins with a proto shield.

Make sure the following pins are connected from the MKRZERO to the flash shield:

Ensure all connections are separated/not shorting and that they are in the correct spots.

When in the Arduino IDE, verify that the correct board for MKRZERO is selected before upload. This is important, different boards typically have different SPI pin mappings.

Use the below header from the Marzogh SPIMemory library (like in the example you attached) (https://github.com/Marzogh/SPIMemory/releases/tag/v3.4.0)
Code: [Select]
#include <SPIFlash.h>
I was also able to verify the example works on a TinyDuino + USB shield + flash shield.