You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SPI.begin must be call even in the SPI library with " transaction" included in the Arduino IDE 1.8.5.
See that example : https://www.arduino.cc/en/Tutorial/SPITransaction.
A good place to include it could be in SPIFlash initialize around line 94 and delete around line 70
/// setup SPI, read device ID etc...
boolean SPIFlash::initialize()
{
_SPCR = SPCR;
_SPSR = SPSR;
pinMode(_slaveSelectPin, OUTPUT);
SPI.begin();
#ifdef SPI_HAS_TRANSACTION
_settings = SPISettings(4000000, MSBFIRST, SPI_MODE0);
#endif
also to get the complete jedecID (3 bytes):
in SPIFlash.h 👍
line 106: uint32_t readDeviceId();
in SPIFlash.cpp:
uint32_t SPIFlash::readDeviceId()
{
#if defined(AVR_ATmega32U4) // Arduino Leonardo, MoteinoLeo
command(SPIFLASH_IDREAD); // Read JEDEC ID
#else
select();
SPI.transfer(SPIFLASH_IDREAD);
#endif
SPI.begin must be call even in the SPI library with " transaction" included in the Arduino IDE 1.8.5.
See that example : https://www.arduino.cc/en/Tutorial/SPITransaction.
A good place to include it could be in SPIFlash initialize around line 94 and delete around line 70
/// setup SPI, read device ID etc...
boolean SPIFlash::initialize()
{
_SPCR = SPCR;
_SPSR = SPSR;
pinMode(_slaveSelectPin, OUTPUT);
SPI.begin();
#ifdef SPI_HAS_TRANSACTION
_settings = SPISettings(4000000, MSBFIRST, SPI_MODE0);
#endif
also to get the complete jedecID (3 bytes):
in SPIFlash.h 👍
line 106: uint32_t readDeviceId();
in SPIFlash.cpp:
uint32_t SPIFlash::readDeviceId()
{
#if defined(AVR_ATmega32U4) // Arduino Leonardo, MoteinoLeo
command(SPIFLASH_IDREAD); // Read JEDEC ID
#else
select();
SPI.transfer(SPIFLASH_IDREAD);
#endif
uint32_t jedecid = SPI.transfer(0) ;
jedecid = jedecid << 16 & 0x00ffffff ;
jedecid |= SPI.transfer(0) << 8 ;
jedecid |= SPI.transfer(0);
unselect();
return jedecid;
}
The text was updated successfully, but these errors were encountered: