wollewald / EEPROM_SPI_WE

Arduino library for SPI based EEPROMs
https://wolles-elektronikkiste.de/en/eeprom-part-3-external-spi-eeproms
MIT License
9 stars 2 forks source link

heap corruption #1

Closed playmiel closed 2 years ago

playmiel commented 2 years ago

when I test the write-read demo after the setup I have a heap corruption (I have an esp32 wrover)

wollewald commented 2 years ago

Hi @playmiel ,

you tested the sketch EEPROM_SPI_WE_basic_read_write.ino, correct?

Did you change lines 69 to 74 as written in the sketch?

Original:

  String stringToWrite = "This is no poetry, I am just a simple test String";
  String stringToRead = "";
  /* For ESP32 and ESP8266 based boards String read/write does not work
     this way. Use char arrays instead: */
  // char stringToWrite[] = "This is no poetry, I am just a simple test String"; 
  // char stringToRead[100] = ""; 

You need to change to:

  // String stringToWrite = "This is no poetry, I am just a simple test String";
  // String stringToRead = "";
  /* For ESP32 and ESP8266 based boards String read/write does not work
     this way. Use char arrays instead: */
  char stringToWrite[] = "This is no poetry, I am just a simple test String"; 
  char stringToRead[100] = ""; 

Without the change I also get the heap corruption error, that's why I wrote this instruction. With the change it works at least on a ESP32 Development Board (ESP-WROOM-32).

playmiel commented 2 years ago

oh I didn't notice the line code in commentary thanks I'll test this tomorrow and I'll let you know if it works well

playmiel commented 2 years ago

hi this works well thanks