| 289 | |
| 290 | |
| 291 | bool SerialFlashChip::ready() |
| 292 | { |
| 293 | uint32_t status; |
| 294 | if (!busy) return true; |
| 295 | SPIPORT.beginTransaction(SPICONFIG); |
| 296 | CSASSERT(); |
| 297 | if (flags & FLAG_STATUS_CMD70) { |
| 298 | // some Micron chips require this different |
| 299 | // command to detect program and erase completion |
| 300 | SPIPORT.transfer(0x70); |
| 301 | status = SPIPORT.transfer(0); |
| 302 | CSRELEASE(); |
| 303 | SPIPORT.endTransaction(); |
| 304 | //Serial.printf("ready=%02x\n", status & 0xFF); |
| 305 | if ((status & 0x80) == 0) return false; |
| 306 | } else { |
| 307 | // all others work by simply reading the status reg |
| 308 | SPIPORT.transfer(0x05); |
| 309 | status = SPIPORT.transfer(0); |
| 310 | CSRELEASE(); |
| 311 | SPIPORT.endTransaction(); |
| 312 | //Serial.printf("ready=%02x\n", status & 0xFF); |
| 313 | if ((status & 1)) return false; |
| 314 | } |
| 315 | busy = 0; |
| 316 | if (flags & 0xC0) { |
| 317 | // continue a multi-die erase |
| 318 | eraseAll(); |
| 319 | return false; |
| 320 | } |
| 321 | return true; |
| 322 | } |
| 323 | |
| 324 | |
| 325 | #define ID0_WINBOND 0xEF |
no outgoing calls
no test coverage detected