I was using Arduino UNO and I wanted to switch a complete sketch to the DUE. If I compile the sketch selecting first as board the arduino UNO everything works well.
If I compile the sketch selecting the arduino DUE board I have some errors.
One of the error for example is due to the thing that I´m not declaring a variable but I´m just using it, as below:
SPDR = dacSPI0;
This is the first line in which the variable SPDR appears and the compiler tells me that this variable is undefined.
Could you explain why this is happening? The compiler is different?
In several aspects, UNO and DUE libraries are different given that they are referenced to their MCUs (AVR and SAM respectively). The SPDR or SPI data register you mention, belongs to the on-chip SPI controller of the AVR and is identified/declared different from the ATSAM3X8E, where two SPI controllers are used. Even though the Arduino/Atmet tried to adapt DUE to the Arduino environment, sometimes it is necessary to do a 'porting' like when using timer registers or like in your case. Indeed, their IDEs are different too. If you can share the UNO sketch you are trying to run in your DUE, we may help with with the porting. Regards!
It focuses on issues to do with DUE and SPI. Its more about using it in slave mode which you do not need but there are, hopefully, loads of info to resolve your issue.