We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm using the ESP32's HSPI ports for communication. When I run the example test code, the device isn't found and the JEDEC ID just shows up as zeros.
I know my wiring is correct and all since I am able to manually send SPI commands to the chip and have it correctly send back the JEDEC ID like so:
Any ideas?
#include <SPI.h> #define JEDECID 0x9F #define WB_READ_STATUS_REG_1 0x05 static const int spiClk = 1000000; // 1 MHz SPIClass SPI1(HSPI); void setup() { Serial.begin(115200); SPI1.begin(); SPI1.setDataMode(0); SPI1.setBitOrder(MSBFIRST); pinMode(15, OUTPUT); //HSPI SS } // the loop function runs over and over again until power down or reset void loop() { byte b1, b2, b3; char buf[128]; digitalWrite(15, HIGH); digitalWrite(15, LOW); SPI1.transfer(JEDECID); b1 = SPI1.transfer(0); // manufacturer id b2 = SPI1.transfer(0); // memory type b3 = SPI1.transfer(0); // capacity digitalWrite(15, HIGH); digitalWrite(15, HIGH); digitalWrite(15, LOW); SPI1.transfer(WB_READ_STATUS_REG_1); while (SPI1.transfer(0) & 1) {}; digitalWrite(15, HIGH); sprintf(buf, "Manufacturer ID: %02xh\nMemory Type: %02xh\nCapacity: %02xh", b1, b2, b3); Serial.println(buf); Serial.println("Ready"); delay(1000); }
The text was updated successfully, but these errors were encountered:
Here's the culprit:
SPIFlash::SPIFlash(uint8_t cs, SPIClass *spiinterface) { _spi = spiinterface; //Sets SPI interface - if no user selection is made, this defaults to SPI if (_spi == &SPI) { _SPIInUse = STDSPI; } else { _SPIInUse = ALTSPI; } csPin = cs; pinMode(csPin, OUTPUT); CHIP_DESELECT }
When using HSPI, it causes _SPIInUse to be ALTSPI. When I modify the code to use STDSPI, it works!
I'm not sure what the difference is much or how best to modify this but there it is :)
Sorry, something went wrong.
Marzogh
No branches or pull requests
I'm using the ESP32's HSPI ports for communication. When I run the example test code, the device isn't found and the JEDEC ID just shows up as zeros.
I know my wiring is correct and all since I am able to manually send SPI commands to the chip and have it correctly send back the JEDEC ID like so:
Any ideas?
The text was updated successfully, but these errors were encountered: