MCPcopy Create free account
hub / github.com/PaulStoffregen/SerialFlash / readID

Method readID

SerialFlashChip.cpp:414–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414void SerialFlashChip::readID(uint8_t *buf)
415{
416 if (busy) wait();
417 SPIPORT.beginTransaction(SPICONFIG);
418 CSASSERT();
419 SPIPORT.transfer(0x9F);
420 buf[0] = SPIPORT.transfer(0); // manufacturer ID
421 buf[1] = SPIPORT.transfer(0); // memory type
422 buf[2] = SPIPORT.transfer(0); // capacity
423 if (buf[0] == ID0_SPANSION) {
424 buf[3] = SPIPORT.transfer(0); // ID-CFI
425 buf[4] = SPIPORT.transfer(0); // sector size
426 }
427 CSRELEASE();
428 SPIPORT.endTransaction();
429 //Serial.printf("ID: %02X %02X %02X\n", buf[0], buf[1], buf[2]);
430}
431
432void SerialFlashChip::readSerialNumber(uint8_t *buf) //needs room for 8 bytes
433{

Callers 1

createMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected