Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

TFT breakout and Arduino WiFi Rev2
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

TFT breakout and Arduino WiFi Rev2

by halasz on Tue Aug 11, 2020 12:27 pm

I am trying to compile the Adafruit ImageReader Library example sketch BreakoutST7735-160x128 for Arduino Uno Wifi Rev2, without success. The compiler reports lots of instances of errors in the file sdspidriver.h like
" … 'SPSR' was not declared in this scope"
and similarly with 'SPIF' and 'SPDR' in place of 'SPSR'.

Is there a work-around for my problem, as some posts seem to be suggesting, or the breakout is, for the time being, incompatible with the processor of the board, as others seem to be doing so? Any remark would be appreciated.

halasz
 
Posts: 6
Joined: Tue Aug 11, 2020 12:03 pm

Re: TFT breakout and Arduino WiFi Rev2

by mikeysklar on Tue Aug 11, 2020 2:46 pm

Hello halasz,

This sounds like a difference in pinouts between your Arduino Uno Wifi Rev2 and the classic Arduino UNO.

The reason for these compilation errors is in the microcontroller: while the common UNO uses an ATmega328P, the Wifi Rev 2 uses a ATmega4809 which is quite a different chip. The SPI registers are different, so any code referring directly to ATmega328P SPI registers won't compile for ATmega4809


viewtopic.php?f=47&t=161677&p=795270&hilit=SPSR+SPIF+SPDR#p795270

Changes to SdSpiDriver.h:

Code: Select all | TOGGLE FULL SIZE
// Use of in-line for AVR to save flash.
#ifdef __AVR__
#if defined (__AVR_ATmega4809__)
#define SPDR SPI0_DATA
#define SPSR SPI0_INTFLAGS
#define SPIF 7
#endif // __AVR_ATmega4809__

mikeysklar
 
Posts: 1644
Joined: Mon Aug 01, 2016 8:10 pm

Re: TFT breakout and Arduino WiFi Rev2

by halasz on Tue Aug 11, 2020 8:05 pm

Dear mikeysklar,

Thank you very much for your quick and detailed reply. I have found posts similar to but not exactly the one you are referring to. Adding the code given the sketch example compiles faultlessly, and board and breakout are working perfectly together.

Needless to say, the code is in Chinese for me as we say it in my native language Hungarian but let me ask one more question about the number 7 in it. Is that a pin number of the board belonging to the hardware SpI? As far as I know, all such pins are on the ICPS header except for the select pin of the board itself (pin 10?).

Yours,
Gabor Halasz

halasz
 
Posts: 6
Joined: Tue Aug 11, 2020 12:03 pm

Re: TFT breakout and Arduino WiFi Rev2

by mikeysklar on Wed Aug 12, 2020 3:45 pm

Hello Gabor,

I am glad to hear you were successful using the above code sample. Good job getting through the language barrier.

The ICSP (programming pins) and the SPI pins are the same on most Arduinos with only a few models being the exception.

mikeysklar
 
Posts: 1644
Joined: Mon Aug 01, 2016 8:10 pm

Re: TFT breakout and Arduino WiFi Rev2

by halasz on Sun Aug 30, 2020 5:09 am

Dear mikeysklar,

Wouldn't it be a good idea to update the official SdSpiDriver.h file by adding the few lines you were suggesting me? As it seems, I am not the only one needing it.

Gabor

halasz
 
Posts: 6
Joined: Tue Aug 11, 2020 12:03 pm

Please be positive and constructive with your questions and comments.


cron