Hello All,
Project https://learn.adafruit.com/animated-ele ... s/software
I see this has been asked before but not answered. I'm trying to complete this project on a Teensy 4.0 because I'm not able to get my hands on a 3.2 or 3.6 Teensy. I understand that with Teensy 4.0 the SPI has changed as well as the pin outs for it. I can compile the sketch without errors for the 3.2 and 3.6 but I receive the following error when trying to select the Teensy 4.0 board.
uncannyEyes: In function 'void drawEye(uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t)':
uncannyEyes:466: error: 'KINETISK_SPI0' was not declared in this scope
while(KINETISK_SPI0.SR & 0xC000); // Wait for space in FIFO
^
uncannyEyes:467: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
uncannyEyes:467: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
uncannyEyes:467: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
uncannyEyes:504: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.SR |= SPI_SR_TCF; // Clear transfer flag
^
uncannyEyes:504: error: 'SPI_SR_TCF' was not declared in this scope
KINETISK_SPI0.SR |= SPI_SR_TCF; // Clear transfer flag
^
'KINETISK_SPI0' was not declared in this scope
Anyone have any ideas?
Electronic Animated Eyes for ARM Microcontrollers By Phillip Burgess
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- l0rdnic0
- Posts: 2
- Joined: Sun Sep 25, 2022 6:09 pm
- michaelmeissner
- Posts: 1819
- Joined: Wed Aug 29, 2012 12:40 am
Re: Electronic Animated Eyes for ARM Microcontrollers By Phillip Burgess
Do you have the 128x128 displays mentioned in the original Adafruit learning section, or do you have the newer 240x240 displays?
If you have the 128x128 TFT display, try using the uncannyEyes7735 example in the ST7735_t3 library. The ST7735_t3 library rewrites the main ST7735 to add various Teensy support for the ST7735 driver used in the 128x128 TFT display. If you have the 128x128 OLED display, perhaps the standard Adafruit_SSD1351 library would work with that example code.
If you have the 240x240 IPS displays, you would want to use the uncannyEyes_async_st7789_240x240 example instead. Note for the Teensy 4.0 and 4.1, in order to use 2 displays, you probably need to use the second SPI bus. Unfortunately on the Teensy 4.0, you would need to solder two wires to pads underneath the Teensy to bring out pins 26 (MOSI1) and 27 (SCLK1). On the Teensy 4.1, these pins are brought out.
If you are still having problems, head over to the Teensy forum (pjrc.com). The 3 people that updated the examples for the ST7735_t3 tend to hang out there (KurtE, defragster, and mjs513).
If you still have problems, I can try it out tomorrow night. I'm busy reworking my uncanny eyes setup, but I should be able to try a Teensy 4.0 with the 128x128 displays. I normally use the 128x128 displays on the Teensy 3.2, 3.5, and 3.6 processors and the 240x240 displays on the Teensy 4.0 and 4.1 processors. Note, my 128x128 TFT displays seem awfully dim and I may need to replace them (its only been 5 or so years since I bought them), but I could at least see if it seems to work.
If you have the 128x128 TFT display, try using the uncannyEyes7735 example in the ST7735_t3 library. The ST7735_t3 library rewrites the main ST7735 to add various Teensy support for the ST7735 driver used in the 128x128 TFT display. If you have the 128x128 OLED display, perhaps the standard Adafruit_SSD1351 library would work with that example code.
If you have the 240x240 IPS displays, you would want to use the uncannyEyes_async_st7789_240x240 example instead. Note for the Teensy 4.0 and 4.1, in order to use 2 displays, you probably need to use the second SPI bus. Unfortunately on the Teensy 4.0, you would need to solder two wires to pads underneath the Teensy to bring out pins 26 (MOSI1) and 27 (SCLK1). On the Teensy 4.1, these pins are brought out.
If you are still having problems, head over to the Teensy forum (pjrc.com). The 3 people that updated the examples for the ST7735_t3 tend to hang out there (KurtE, defragster, and mjs513).
If you still have problems, I can try it out tomorrow night. I'm busy reworking my uncanny eyes setup, but I should be able to try a Teensy 4.0 with the 128x128 displays. I normally use the 128x128 displays on the Teensy 3.2, 3.5, and 3.6 processors and the 240x240 displays on the Teensy 4.0 and 4.1 processors. Note, my 128x128 TFT displays seem awfully dim and I may need to replace them (its only been 5 or so years since I bought them), but I could at least see if it seems to work.
- l0rdnic0
- Posts: 2
- Joined: Sun Sep 25, 2022 6:09 pm
Re: Electronic Animated Eyes for ARM Microcontrollers By Phillip Burgess
You sir..... are a saint! Thank you this is just what I needed. I was able to compile and get up and running in seconds.
Someone should update the https://learn.adafruit.com/animated-ele ... s/overview to include this information.
KUDOS michaelmeissner!
Someone should update the https://learn.adafruit.com/animated-ele ... s/overview to include this information.
KUDOS michaelmeissner!
- michaelmeissner
- Posts: 1819
- Joined: Wed Aug 29, 2012 12:40 am
Re: Electronic Animated Eyes for ARM Microcontrollers By Phillip Burgess
You are welcome. I'm glad it worked.
Note, I have found that depending on the setup and the displays, that you may need to slow down the SPI frequency (SPI_FREQ).
Using breadboards and jumper wires, I find that the 128x128 OLED displays will start glitching if the frequency is above 11000000U. With TFT displays, I use 23000000U. Obviously if your displays aren't glitching, then you don't have to worry about it.
Another thing that you should consider is using 3 separate 2.2K pull-up resistors between the 3 CS/DC pins and 3.3v. Using the 240x240 displays on two separate SPI buses you don't need the pull-up resistor, but with 2 128x128 displays on a single SPI bus (as you needed to do with the Teensy 3.x processor) using a pull-up resistor can help since the Teensy is rapidly switching from one display to another. A pull-up resistor has a connection to the data pin on one end, and a connection to 3.3v power on the other.
Note, I have found that depending on the setup and the displays, that you may need to slow down the SPI frequency (SPI_FREQ).
Using breadboards and jumper wires, I find that the 128x128 OLED displays will start glitching if the frequency is above 11000000U. With TFT displays, I use 23000000U. Obviously if your displays aren't glitching, then you don't have to worry about it.
Another thing that you should consider is using 3 separate 2.2K pull-up resistors between the 3 CS/DC pins and 3.3v. Using the 240x240 displays on two separate SPI buses you don't need the pull-up resistor, but with 2 128x128 displays on a single SPI bus (as you needed to do with the Teensy 3.x processor) using a pull-up resistor can help since the Teensy is rapidly switching from one display to another. A pull-up resistor has a connection to the data pin on one end, and a connection to 3.3v power on the other.
Please be positive and constructive with your questions and comments.