Can someone help me about the code? I am getting error

Hello everyone.
I am working on one project. I don't have any experience with Arduino and coding.
I am getting errors when I am trying to upload code to my Arduino Nano every.
ERRORS;

Arduino: 1.8.19 (Windows 10), Board: "Arduino Nano Every, ATMEGA328"

WARNING: library U8glib claims to run on avr, sam architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s).

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c: In function 'u8g_spi_out':

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:184:3: error: 'SPDR' undeclared (first use in this function); did you mean 'SDA'?

SPDR = data;

^~~~

SDA

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:184:3: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:186:12: error: 'SPSR' undeclared (first use in this function); did you mean 'SPDR'?

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

        ^~~~

        SPDR

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:186:23: error: 'SPIF' undeclared (first use in this function); did you mean 'SPI0'?

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

                   ^~~~

                   SPI0

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c: In function 'u8g_com_arduino_hw_spi_fn':

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:220:7: error: 'SPCR' undeclared (first use in this function); did you mean 'SCL'?

   SPCR = 0;

   ^~~~

   SCL

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:221:19: error: 'SPE' undeclared (first use in this function); did you mean 'PE'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);

               ^~~

               PE

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:221:30: error: 'MSTR' undeclared (first use in this function); did you mean 'PSTR'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);

                          ^~~~

                          PSTR

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:221:40: error: 'SPR1' undeclared (first use in this function); did you mean 'SPE'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);

                                    ^~~~

                                    SPE

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:221:50: error: 'SPR0' undeclared (first use in this function); did you mean 'SPR1'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);

                                              ^~~~

                                              SPR1

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:221:60: error: 'CPOL' undeclared (first use in this function); did you mean 'CCL'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);

                                                        ^~~~

                                                        CCL

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:221:70: error: 'CPHA' undeclared (first use in this function); did you mean 'CPOL'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);

                                                                  ^~~~

                                                                  CPOL

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:227:2: error: 'SPSR' undeclared (first use in this function); did you mean 'SPCR'?

SPSR = (1 << SPI2X); /* double speed, issue 89 */

^~~~

SPCR

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_hw_spi.c:227:15: error: 'SPI2X' undeclared (first use in this function); did you mean 'SPI_t'?

SPSR = (1 << SPI2X); /* double speed, issue 89 */

           ^~~~~

           SPI_t

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_port_d_wr.c: In function 'u8g_com_arduino_port_d_8bit_wr':

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_port_d_wr.c:72:9: error: incompatible types when assigning to type 'PORT_t {aka struct PORT_struct}' from type 'uint8_t {aka unsigned char}'

PORTD = val;

     ^

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_port_d_wr.c: In function 'u8g_com_arduino_port_d_wr_fn':

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_port_d_wr.c:91:7: error: 'DDRD' undeclared (first use in this function); did you mean 'DD7'?

   DDRD = 0x0ff;

   ^~~~

   DD7

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_port_d_wr.c:91:7: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_port_d_wr.c:92:13: error: incompatible types when assigning to type 'PORT_t {aka struct PORT_struct}' from type 'int'

   PORTD = 0x0ff;

         ^

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c: In function 'u8g_arduino_st7920_hw_spi_shift_out':

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:102:3: error: 'SPDR' undeclared (first use in this function); did you mean 'SDA'?

SPDR = val;

^~~~

SDA

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:102:3: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:104:12: error: 'SPSR' undeclared (first use in this function); did you mean 'SPDR'?

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

        ^~~~

        SPDR

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:104:23: error: 'SPIF' undeclared (first use in this function); did you mean 'SPI0'?

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

                   ^~~~

                   SPI0

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c: In function 'u8g_com_arduino_st7920_hw_spi_fn':

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:204:7: error: 'SPCR' undeclared (first use in this function); did you mean 'SCL'?

   SPCR = 0;

   ^~~~

   SCL

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:207:19: error: 'SPE' undeclared (first use in this function); did you mean 'PE'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);

               ^~~

               PE

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:207:30: error: 'MSTR' undeclared (first use in this function); did you mean 'PSTR'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);

                          ^~~~

                          PSTR

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:207:40: error: 'SPR1' undeclared (first use in this function); did you mean 'SPE'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);

                                    ^~~~

                                    SPE

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:207:50: error: 'SPR0' undeclared (first use in this function); did you mean 'SPR1'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);

                                              ^~~~

                                              SPR1

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:207:60: error: 'CPOL' undeclared (first use in this function); did you mean 'CCL'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);

                                                        ^~~~

                                                        CCL

C:\Users\senca\Documents\Arduino\libraries\U8glib\src\clib\u8g_com_arduino_st7920_hw_spi.c:207:70: error: 'CPHA' undeclared (first use in this function); did you mean 'CPOL'?

   SPCR =  (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);

                                                                  ^~~~

                                                                  CPOL

exit status 1

Error compiling for board Arduino Nano Every.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Welcome to the forum

Please post the sketch that produced the errors. Note the following advice

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

NOTE this warning. The U8glib library is not compatible with your Arduino

Since the Nano Every uses the ATMega4809, the text you quoted seems odd.

Even with 328p register emulation, I saw no mention of the ATMEGA328 when I complied a small sketch as a test.

Even with 328p register emulation, the Every is not usable with everything you'd expect just by going on the Nano part of its name. It is a different beast.

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.