Closed perigalacticon closed 6 years ago
The relevant code lines from DataFlash.cpp are:
/* Save SPI registers with settings for DataFlash for fast restore
* in .begin(). */
m_SPSR = (SPSR & SPI_2XCLOCK_MASK);
m_SPCR = SPCR;
/* Clear pending SPI interrupts */
#ifdef __AVR__
uint8_t clr;
clr = SPSR;
clr = SPDR;
(void) clr; // Prevent variable set but unused warning. No code generated.
#endif`
I think the problem may be with the definition of "SPI_2XCLOCK_MASK", I found it in Arduino file "SPI.h": https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/libraries/SPI/src/SPI.h `
`
It looks like the library is compatible with the AVR core, but not the SAM or SAMD cores. While there is an "#ifdef AVR" in at least one place, there are other places in the code that reference the SPSR and SPCR registers, which do not exist with SAMD. It looks like the dataflash library mostly uses the SPI library, but it directly accesses these registers (looks like only once), breaking compatibility for non-AVR. This should be pretty easy to fix, but you will have to contact the author. It looks like a performance enhancement that should not be needed for the SAMD.
I would like to use a library for interfacing with Dataflash, D series SPI Flash memory with the SAMD11. I am successfully using the "arduino-dataflash" library (by Mooz from https://github.com/BlockoS/arduino-dataflash ) with ATTINY841 boards but for the SAMD11 the compiler gives the following error:
I am using the Generic D11C14A board option from the Beta Core in the Arduino IDE.
Do you understand this error and how I might make this library work with the SAMD11 with your core?