jbilander / sdbox

A parallel to sd-card project for the Amiga
GNU General Public License v3.0
94 stars 14 forks source link

Nano Every #21

Open 2of5aliasmaik opened 11 months ago

2of5aliasmaik commented 11 months ago

I replaced the Nano with a Nano Every and get the error messages listed below when compiling Main.c. Is the Nano Every with its 4809 so different than the Nano with the 328. Yes, some pins have different names, but if they are adjusted it should work, right? If I use a Uno for testing purposes, compiling and uploading works without any problems, the same chip is installed here and the pin assignment is identical. I hope someone can explain this to me or, best of all, adapt the Main.c to the Every.

D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino: In function 'int main()': D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:5: error: 'SPCR' was not declared in this scope SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:5: note: suggested alternative: 'SCL' SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ SCL D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:18: error: 'SPE' was not declared in this scope SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:18: note: suggested alternative: 'PE' SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~ PE D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:31: error: 'MSTR' was not declared in this scope SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:31: note: suggested alternative: 'PSTR' SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ PSTR D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:45: error: 'SPR1' was not declared in this scope SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:45: note: suggested alternative: 'SPI0' SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ SPI0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:59: error: 'SPR0' was not declared in this scope SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:34:59: note: suggested alternative: 'SPI0' SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0); ^~~~ SPI0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:35:5: error: 'SPSR' was not declared in this scope SPSR |= (1 << SPI2X); ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:35:5: note: suggested alternative: 'SS' SPSR |= (1 << SPI2X); ^~~~ SS D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:35:19: error: 'SPI2X' was not declared in this scope SPSR |= (1 << SPI2X); ^~~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:35:19: note: suggested alternative: 'SPI_t' SPSR |= (1 << SPI2X); ^~~~~ SPI_t D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:50:9: error: 'PIND' was not declared in this scope if (PIND & (1 << CLOCK_BIT)) ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:50:9: note: suggested alternative: 'PIN0' if (PIND & (1 << CLOCK_BIT)) ^~~~ PIN0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:61:11: error: 'PIND' was not declared in this scope if (!(PIND & 0x80)) ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:61:11: note: suggested alternative: 'PIN0' if (!(PIND & 0x80)) ^~~~ PIN0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:69:9: error: 'PIND' was not declared in this scope v = PIND; ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:69:9: note: suggested alternative: 'PIN0' v = PIND; ^~~~ PIN0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:70:9: error: 'PINC' was not declared in this scope w = PINC; ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:70:9: note: suggested alternative: 'PIN0' w = PINC; ^~~~ PIN0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:109:5: error: 'SPDR' was not declared in this scope SPDR = 0xff; ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:109:5: note: suggested alternative: 'SDA' SPDR = 0xff; ^~~~ SDA D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:120:27: error: 'SPIF' was not declared in this scope while (!(SPSR & (1 << SPIF))) ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:120:27: note: suggested alternative: 'SPI0' while (!(SPSR & (1 << SPIF))) ^~~~ SPI0 D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:190:27: error: 'SPIF' was not declared in this scope while (!(SPSR & (1 << SPIF))) ^~~~ D:\Daten\Dokumente\Arduino\Sketch_SDBox\Sketch_SDBox.ino:190:27: note: suggested alternative: 'SPI0' while (!(SPSR & (1 << SPIF))) ^~~~ SPI0

exit status 1

Compilation error: 'SPCR' was not declared in this scope

jbilander commented 11 months ago

Hi,

for the AVR we build with avr-gcc by running build.bat, try that. You can see the commands used if you click the build.bat file in the repository, you will need to change the -mmcu=atmega328p parameter https://github.com/jbilander/sdbox/tree/master/avr

image

SukkoPera commented 1 month ago

SPI registers are totally different on the ATmega4809, the code will never work as-is, it needs quite some adaptation.