compile errors with uno wifi rev 2 and SDfat

Hi,

compiling a sketch for the UNO Wifi Rev 2 and SD-shield using SDfat i get these errors:

sketchbook\libraries\sdfat\src\spidriver\sdspidriver.h:392:3: error: ‘SPDR’ was not declared in this scope

SPDR = 0XFF;

^~~~
note: suggested alternative: ‘SPI’

and then a lot more in the same manner:

‘SPSR’ was not declared in this scope

while (!(SPSR & (1 << SPIF))) {}

note: suggested alternative: ‘SPDR’

‘SPIF’ was not declared in this scope

while (!(SPSR & (1 << SPIF))) {}

suggested alternative: ‘SPI’

‘SPSR’ was not declared in this scope

while (!(SPSR & (1 << SPIF))) {}

suggested alternative: ‘SPDR’

what can i do about that?

thanks for any advise.

rolf

  1. Which version of the Sdfat library are you using in your project?
  2. Did you modify any aspect of the SdFatConfig.h file?

The library as it is in the Greiman repository this configuration to work on AVR boards, so I suggest as a first point, download it again and remove the version you have installed.

Arduino Uno wifi rev2 does not use an AVR microcontroller.

The library might not be compatible.

Wifi rev2 uses megaavr architecture. Same instruction set, but the peripherals are all different. The version of sdfat you are using is trying to manipulate classic avr spi registers that dont exist on the megaavr parts. I do not know if a version that supports megaavr processors is available