new Teensy 3.6 user

Status
Not open for further replies.

32bits

Member
Hi this is my first post as a new user of Teensy 3.6 and Arduino.

If my questions as a new user are covered elsewhere please send links to find the information. My background is a hobbyist learning C and previously coding PIC32's with various I2C sensors, BME280, TSL light level, rotary encoder, 320 x 240 LCD, GPS etc. My plans for the Teensy include driving a larger TFT display, 5" or 7" hopefully with no updating/refresh lag and show screen layouts designed with graphic primitives. The PIC32 currently used is out of steam for anything larger than 320 x 240, video playback is not required. Below are some of my questions.

1/ I have checked the list of libraries on the RJRC site and a TFT version is not listed, I have used ILI9341 via a Mikro C library, which gives lines, circles, fonts, dots etc and wonder if a similar TFT library is available for the Teensy and also Libraries for other TFT chipsets?

2/ For supported TFT libraries how fast are they for screen updates and complete screen redraws? It would also be good to know if any libraries use a frame buffer / DMA to update the TFT and if all the library commands are documented and where to find the information and files to download.

3/ Coming from a more professional IDE how feasible is writing a large program (100-200 lines or larger) in the Arduino IDE and are there better IDE's available that will work with Teensy, to write, compile and program a Teensy board all from one Windows / Unix environment?

Michael
 
Last edited:
For ILI9341, normally this optimized library is used:

https://github.com/PaulStoffregen/ILI9341_t3
https://www.pjrc.com/store/display_ili9341_touch.html
https://www.youtube.com/watch?v=tioOB3Ysz70

Frank made a frame buffer & DMA version for his C64 emulator project.

https://forum.pjrc.com/threads/46168-posted-Commodore-C64-Emulation-on-a-Teensy-3-6-Microcontroller

For larger displays, the RA8875 controller is popular. Adafruit has a not-very-optimized library that's very stable. Sumotoy wrote an optimized one a few years ago.

https://github.com/sumotoy/RA8875

If you do use the RA8875, know that it doesn't proper tri-state is MISO pin, so a buffer chip is needed if using other SPI chip on the same SPI bus.

The Arduino IDE works really well for small to medium size programs. More than 500 to 1000 lines tends to become a bit cumbersome. Usually people move code to libraries, to keep the "sketch" code in the Arduino IDE to something relatively small.
 
For larger programs you can select "Use external editor" in your Arduino IDE preferences, use whichever IDE you prefer for writing code and then use the Arduino IDE only for build / upload. I do this for my personal projects and for creating Arduino libraries, etc. Arduino now allows you to co-locate header and source files with your .ino "main" file (IIRC either in the same folder as the .ino or in subfolders), which enables you to sort your code without needing to use libraries. My preference is to create libraries for generically useful code and use header / source files co-located with the .ino for logically splitting larger programs.

For large projects that I collaborate on with others that require a certain board type and configuration (i.e. Teensy 3.6 running at 240 MHz), I prefer to use makefiles, which allow locking down all of the board settings and enable easy modification of the Teensy core without effecting other projects. It takes knowledge of make and some time to setup, so I would only suggest that approach if it's truly a need. You can google to find a few example makefiles to start from.
 
Thanks for your help. A question for the choice of display, will any display size/resolution supporting a RA8875 or ILI9341 controller work with the suggested display libraries ?
 
Last edited:
The ili9341_t3 library will work with ili9341 controllers. These libraries I believe only currently support the default resolutions of these displays 320x240. But you can set the rotations so you can have it in either landscape or portrait mode.

I have not done much with the RA8875 displays, I have played with it on one or two displays. The readme as part of the github project Paul linked to tells which ones he had working. Unfortunately I have not seen anything posted by Sumotoy either on the forums or up on Github, so not sure what the state of some of these drivers are.

As mentioned Frank has one that does some DMA with these displays. My version ili9341_t3n also does DMA. Again in both cases these libraries only will do this with the T3.5 or T3.6.

I have not looked at Frank's version in a long time, but originally it was great for continuous updates, but at the time was not as much geared toward single updates at a time. My version was more geared toward the later... Also integrated the ability to set clip rectangles and the like.

As for IDE, as was mentioned, you have the ability to do development in many different ways.

For a few 100 lines, the Arduino IDE works reasonably.

For larger projects, I often use an external editor as @brtaylor mentioned.
Others use VisualMicro which has Arduino plug ins for Visual Studio.
Others use eclipse with Arduino plug ins.

Again lots of options
 
will any display size/resolution supporting a RA8875 or ILI9341 controller work with the suggested display libraries ?

Generally ILI9341 is only 320x240 and RA8875 tends to support 2 specific resolutions. Going off those well worn paths might sometimes work, but problems would be pretty likely.
 
I have pm'ed Frank for his feedback on driving larger displays and if his library supports resolutions up to 800 x 480 for a 5" display, I don't know enough about the different controllers and which type is generally used at these resolutions so any feedback is welcome. Do you know if the Teensy 3.6 has enough memory to support these resolutions, if it has, then this would be a good application for the 3.6.

I will also try out VisualMicro with Arduino plugin for Visual Studio as an alternative IDE.
 
Last edited:
Do you know if the Teensy 3.6 has enough memory to support these resolutions.

Definitely not as a frame buffer in RAM. Teensy 3.6 has 256K RAM.

To compute the RAM used for a frame buffer, just multiply the horizontal by vertical pixels, and then multiply by 2 or 3, depending on whether you'll use 16 or 24 bit color.

A frame buffer for 320x240 can fit. But a 800x480 frame buffer is *far* beyond the scale of only 256K RAM.

Of course you can use such large displays with a controller like RA8875 which has the frame buffer built into the controller. The normal way ILI9341 is used also leverages the frame buffer inside the ILI9341 controller.
 
I am about 99% sure that the ili9341 drivers will now support 800x480. The controller spec that I have shows it specific for 240x320 262K color display controller.
And if it did, a simple frame buffer would take 800*480*2=768K of memory which is hard to fit in 256K of ram.
 
Just in case I am not fully understanding the use of the Teensy and display controller, is the basic operation of your optimized 320 x 240 libraries to write changes/updates to the controller frame buffer, which then generates the display? It would also be good to know how use of DMA helps with speeding up display refresh. Apologies for all my questions as I am trying to decide if the Teensy 3.6 is the best platform for driving a larger display and what would be involved in getting it working.
 
The display maintains a memory image of what is displayed. The controller receives commands to alter that memory.

For the ILI9341 the T_3.2 inspired Paul to make a very optimized SPI interface driver library to the controller. This makes those updates possible in a fast and efficient manner. The T_3.6 can use the same code and in fact has internal RAM to support a full size LOCAL Teensy buffer that can be updated faster on the Teensy and then sent out in whole to the display.

When it comes to DMA that is a programmatically controlled 'background' process that in this case reads from the Teensy RAM buffer and pushes that data out over SPI as needed using the controller's interface to quickly update some or all of the memory on the display.
 
I think that you can‘t say this or that MCU is best to drive a larger display in general, because there are lots of factors which come into the game, like the complexity of the rendering code (will you only display text and simple geometric forms, or more complex graphics, at which refresh rate), most probably in addition to acquire input data from peripherals, and process it, which can also represent already some heavy CPU load, always admitting that you won’t run the Teensy 3.6 as a simple GPU in slave mode.
The first step would be formulating the exact specifications of your project to allow a realistic estimation of the needed computing power (which can also depend on the efficiency of your code, not everybody can write optimized embedded code), memory, and integrated peripheral capabilities. Then, in a second step, studying different MCU data sheets, ordering a few different samples and building/testing/optimizing several prototypes will finally guide you towards the best processor.
 
For ILI9341, Teensy 3.2, 3.5 & 3.6 are great. ILI9341_t3 is very well optimized.

For larger displays, the reality is usually either using available libraries, or trying to craft your own. The experience varies depending on which specific display and whether anyone has written a library, and how much optimization work as been done on that library. Often the only available libs are from Adafruit, where their focus is compatibility for many boards but little to no work on optimizations. Some people here, notably FrankB & Sumotoy have done some excellent optimization work on specific libraries.

But the point is everything depends on which specific display & controller. There simply isn't any generic answer, as you're asking, other than "it depends" on which specific display, what libraries have already been written, and whether you wish to just use an already-working library or dig into the library details.
 
It might help if I give more scope for my application. My current project runs on a PIC32MX 80MHz,output is to a320x 240 TFT, coded in C and using Mikro C and their closed TFT library. The code is over 5,000 lines and has the following IC2 sensors, light, BME280 (humidity, temp, pressure), DS3231 RTC, also connected is a GPS read by a UART, user control is via rotary encoder and center push switch. The user selects one of 7 top level menu/screens and the display then updates for the selection, this requires most of the display to update. The display can be set to show updating graphs for temp, humidity and pressure for last 24 hours and 7 days. The problem is there is now too much data to show on a 320 x 240 screen, it really needs a larger screen with higher resolution, the PIC32 with Mikro TFT library is on it's limit updating the current screen so a faster CPU with better TFT libraries is needed or make a big change and move to a Rpi. The actual screen updates are not that fast after each screen is initially redrawn, I have limited updates to only parts of the screen to keep flicker/updates less noticeable. The only constant screen updating is the time being shown in larger type font at the top of the screen and this changes only once /sec.

So for the question of preferred library and or screen, I should have really asked what Teensy 3.6 libraries are available for any controller type suitable to drive a 5" TFT display at 800 x 400?

Looking on Adafruits webpage they have the RA8875 Driver Board for 40-pin TFT Touch Displays - 800x480 Max and a library available which might work with the Teensy, then add their 5.0" 40-pin TFT Display - 800x480 with Touchscreen. But it would be good to know if alternative Displays exist that have been tested and any better libraries written to drive them, that work with Teensy. I don't have the coding skills to write my own Libraries or modify existing ones as I only started coding in C last year.
 
It might help if I give more scope for my application. My current project runs on a PIC32MX 80MHz,output is to a320x 240 TFT, coded in C and using Mikro C and their closed TFT library. The code is over 5,000 lines and has the following IC2 sensors, light, BME280 (humidity, temp, pressure), DS3231 RTC, also connected is a GPS read by a UART, user control is via rotary encoder and center push switch. The user selects one of 7 top level menu/screens and the display then updates for the selection, this requires most of the display to update. The display can be set to show updating graphs for temp, humidity and pressure for last 24 hours and 7 days. The problem is there is now too much data to show on a 320 x 240 screen, it really needs a larger screen with higher resolution, the PIC32 with Mikro TFT library is on it's limit updating the current screen so a faster CPU with better TFT libraries is needed or make a big change and move to a Rpi. The actual screen updates are not that fast after each screen is initially redrawn, I have limited updates to only parts of the screen to keep flicker/updates less noticeable. The only constant screen updating is the time being shown in larger type font at the top of the screen and this changes only once /sec.

So for the question of preferred library and or screen, I should have really asked what Teensy 3.6 libraries are available for any controller type suitable to drive a 5" TFT display at 800 x 400?

Looking on Adafruits webpage they have the RA8875 Driver Board for 40-pin TFT Touch Displays - 800x480 Max and a library available which might work with the Teensy, then add their 5.0" 40-pin TFT Display - 800x480 with Touchscreen. But it would be good to know if alternative Displays exist that have been tested and any better libraries written to drive them, that work with Teensy. I don't have the coding skills to write my own Libraries or modify existing ones as I only started coding in C last year.

Not display related, but my startup has a good BME280 driver available, which is known to work well on all of the Teensy 3.x and LC devices.
https://github.com/bolderflight/BME280

Similarly, we also have a good uBlox library if you're using a uBlox GPS.
https://github.com/bolderflight/UBLOX
 
brtaylor, I will try out your your BME280 and UBLox libraries, my code works but is not always reliable. Paul, for the display I will buy an 5 or 7" RA8875 and try Sumotoy's Libraries when the display arrives from China. KurtE I have downloaded Visual Studio + Arduino plugin and all works first time with my Teensy3.6, it's a good improvement. Everyone's help is appreciated.
 
Some feedback for my questions using Teensy 3.6 with larger displays, I have successfully loaded Sumotoy's RA8875 lib and connected to a 7" East Rising Display, the make was recommended by Sumotoy, and it works with no issues. Reading Sumotoy's comments I don't think he had tested the 7" display type ER-TFTM070-5 so if anyone is considering a project requiring a larger display and fast screen updates, I can confirm this is a good solution. For power consumption the Teensy 3.6 runs at 100ma and the display with internal set PWM brightness runs at 400ma. For the lib navigate to https://forum.pjrc.com/threads/40252-Teensy-3-6-with-RA8875-TFT?highlight=Sumotoy and note Kurt's 2nd comment box and the download zip contained there. I have not tried the spin versions to use alternative pins on the Teensy 3.6.
 
Status
Not open for further replies.
Back
Top