MCUdude / MightyCore

Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535
Other
637 stars 181 forks source link

Can't compile code when SPI1 is used in Arduino IDE #209

Closed shakil-anwar closed 3 years ago

shakil-anwar commented 3 years ago

I get error: 'SPCR1' was not declared in this scope

C:\Users\Asus\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.0\libraries\SPI1\src/SPI1.h:292:31: note: suggested alternative: 'SPCR'

 if (bitOrder == LSBFIRST) SPCR1 |= _BV(DORD);

                           ^~~~~
                           SPCR

I am getting many similar errors , while compiling with SPI1.begin() and SPI1.transfer(..,..);

MCUdude commented 3 years ago

Which microcontroller are you compiling for? ATmega1284P?

shakil-anwar commented 3 years ago

yes I was trying to compile for atmega1284p

MCUdude commented 3 years ago

The 1284P only has one SPI peripheral. SPI1 is only for the ATmega324PB.

tomaskovacik commented 3 years ago

https://www.microchip.com/wwwproducts/en/ATmega1284P "Digital Communication Peripherals 2-UART, 3-SPI, 1-I2C"

the datasheet talks about only one SPI interface

but there is the possibility to create two additional SPI masters using USARTs, check datasheet

"The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) can be set to a master SPI compliant mode of operation."

edit: 2x USART = +2x SPI

edit2: http://www.gammon.com.au/spi search USART