Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: SerialFlash.begin always returns true, even when no SPI flash is connected

  1. #1
    Senior Member Ben's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    401

    SerialFlash.begin always returns true, even when no SPI flash is connected

    Hi,

    I today tried to determine if an SPI flash IC is connected by checking the SerialFlash.begin return value. Turns out the function returns true unconditionally.

    I reproduced this with a Teensy 3.2 with nothing attached and the ListFiles example. This error message:

    Code:
    if (!SerialFlash.begin(FlashChipSelect)) {
        error("Unable to access SPI Flash chip");
      }
    is never printed over Serial.

    Ben

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,198
    Hmmm, looks like the library's begin() should check some of the readID() bytes and if all 0 or all 0xff return false. capacity() already does such a check, so maybe in begin() one would add
    Code:
    ...
           readID(id);
           if ((id[0]==0 && id[1]==0 && id[2]==0) || 
    		(id[0]==255 && id[1]==255 && id[2]==255)) {
    		return false;
           }
           f = 0;
    Last edited by manitou; 01-07-2018 at 11:49 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •