SPIMemory icon indicating copy to clipboard operation
SPIMemory copied to clipboard

Bug report - readByteArray fails at some addresses but no in a loop.

Open spinalcode opened this issue 3 years ago • 0 comments

Bug Report

Describe the bug

When trying to read data from specific address I get 0x0D error, but not always.

  • Make sure you have run FlashDiagnostics.ino with #define RUNDIAGNOSTICS uncommented in SPIFlash.h. Paste the relevant sections of the output from your Serial console when you run FlashDiagnostics.ino.here:
JEDEC ID: 0xEF4018
Man ID: 0xEF
Memory ID: 0x40
Capacity: 16777216
Max Pages: 65536
Unique ID: 2877041191891200, 0x601021675A3F3100
** ALL RESULTS PASSED **

To Reproduce

Provide a minimal code snippet example that reproduces the bug (If you're using one of the examples that came with the library, just tell us which one instead of pasting the entire example's code). Please make sure you wrap any code in the proper code blocks like below

/* This works perfectly */
void loadScreenFromFlash(){
  uint16_t lineBuffer[240];
  uint8_t lineBuffer8[240];
  for(int y=0; y<240; y++ ){
    if (flash.readByteArray(y*240, lineBuffer8, 240,1)) {
     for(int x=0; x<240; x++){
        lineBuffer[x] = pgm_read_word(&brain_pal[lineBuffer8[x]]);
      }
      //lcd.drawImage(0,y,240,1,lineBuffer);
    }
  }
}

/* This fails when y >= 137 with 0x0D error (4bit alignment) */
void loadLineFromFlash(int y){
  uint16_t lineBuffer[240];
  uint8_t lineBuffer8[240];
  if (flash.readByteArray(y*240, lineBuffer8, 240,1)) {
   for(int x=0; x<240; x++){
      lineBuffer[x] = pgm_read_word(&brain_pal[lineBuffer8[x]]);
    }
    //lcd.drawImage(0,y,240,1,lineBuffer);
  }else{
    Serial.print("Failed to load line ");
    Serial.print(y);
  }
}

Expected behavior

flash.readByteArray to work the same in both functions above

Screenshots

If applicable, add screenshots to help explain your problem.

Wiring diagram

If applicable, add a wiring diagram to help explain your problem.

Software environment (please complete the following information):

  • Library version: v3.4.0
  • Arduino IDE version: 1.8.13
  • OS: Windows 10
  • Micro controller platform: Beetle ble (atmega238)
  • Flash/Fram memory module: winbond w25q128jv-flash

Additional context

Add any other context about the problem here.


DO NOT DELETE OR EDIT anything below this

Note 1: Make sure to add all the information needed to understand the bug so that someone can help. If any essential information is missing we'll add the 'Needs more information' label and close the issue until there is enough information.

Note 2: For support questions (for example, tutorials on how to use the library), please use the Arduino Forums. This repository's issues are reserved for feature requests and bug reports.


GitHub issue state GitHub issue title GitHub issue author GitHub issue label GitHub issue comments GitHub issue age GitHub issue last update

spinalcode avatar Mar 10 '21 16:03 spinalcode