fix infinite loop bug when HIGH-Z MISO stays high

When FLASH chip is not present and MISO is in high impedance, other SPI
devices might pull MISO high and the while(busy) loop might never return
because of a false positive busy (actually MISO would return 0XFF for
status register including the BUSY bit)
This commit is contained in:
Felix Rusu 2013-08-02 00:02:46 -04:00
parent 53156895f3
commit 0efea19ac2
1 changed files with 3 additions and 1 deletions

View File

@ -62,7 +62,9 @@ boolean SPIFlash::initialize()
/// Get the manufacturer and device ID bytes (as a short word) /// Get the manufacturer and device ID bytes (as a short word)
word SPIFlash::readDeviceId() word SPIFlash::readDeviceId()
{ {
command(SPIFLASH_IDREAD); // Read JEDEC ID //command(SPIFLASH_IDREAD); // Read JEDEC ID
select();
SPI.transfer(SPIFLASH_IDREAD);
word jedecid = SPI.transfer(0) << 8; word jedecid = SPI.transfer(0) << 8;
jedecid |= SPI.transfer(0); jedecid |= SPI.transfer(0);
unselect(); unselect();