Problems writing to Flash memory

César Bárcenas

  • Newbie
  • *
    • Posts: 2
    • View Profile
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.  :)


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
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


César Bárcenas

  • Newbie
  • *
    • Posts: 2
    • View Profile
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.  :-\


Jason

  • Administrator
  • Hero Member
  • *****
    • Posts: 107
  • TinyCircuits Employee
    • View Profile
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:
  • MKRZERO SCK    -> flash/proto SCK
  • MKRZERO MISO -> flash/proto MISO
  • MKRZERO MOSI -> flash/proto MOSI
  • MKRZERO digital pin 5  -> flash/proto CS/SS
  • MKRZERO +5v  -> flash/proto VCC
  • MKRZERO GND  -> flash/proto GND

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.
« Last Edit: October 07, 2021, 11:14:49 AM by Jason »


 

SMF spam blocked by CleanTalk