Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: teensy 3.2 nextion

  1. #1

    teensy 3.2 nextion

    I use a teensy 3.2 and a uart nextion display, now to update the display I have to connect it with a ttl usb converter.
    I have two possibilities
    N1) that the teensy acts as usb ttl when I have to program the dislpay
    N2) I have to put some diodes on the rx and tx line so that when I have to update I leave both the teensy and the display connected and I add the ttl usb converter.
    What do you recommend? are there other solutions?

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Colmar, France
    Normally, once the firmware for the Nextion written, compiled, tested, validated and uploaded, there shouldn’t be the need to update it, if the HMI design was made thoughtful and purposeful. I’ve a project with Teensy and Nextion which can take 5 variants. I packed everything on different pages in the HMI, so that the application running on the Teensy can decide which pages are used and which not. Thus, I preload the Nextions once with the firmware before they are connected to the respective Teensy and then, this package goes out to the customer.
    If, in a few years or so, a Nextion firmware upgrade would really be required, but I really can’t imagine not having anticipated everything, I’d tell the customers to download the new tft file, copy it on a SD card and put the latter directly into the Nextion’s SD slot, so that the Nextion will update itself at the next power up.

  3. #3
    Hi, the problem is that to put the sd I have to disassemble the display due to the limited space.
    However I make a connector and I carry the wires of the serial to a diverter where I decide whether to program I have normal use.
    Hello and thanks

  4. #4
    Member Etienne's Avatar
    Join Date
    Mar 2016
    Ardeche, France
    Hi vlelectroniclab, I was about to open the same kind of topic, so I'll take the opportunity to use yours since my problem is related to your request.

    I've been struggling for a long time now trying to program a 3.2" Nextion screen using the Teensy 3.2 as a serial bridge, without success so far.
    For the application I'm working on (screen embedded in a steering wheel using SimHub), being able to update the Nextion often is mandatory because I want to support many types of cars, and try different features.
    I've tried with several baud rates (19200, 38400, 115200), with and differents CPU clocks, with Serial1 and Serial3, none of them work (upload proceeds until the end, but I get a CRC check error at the end).

    It works with a Teensy LC and with a Teensy 3.6 at 115200 bauds, without a problem (I'm using the USBToSerial example, with the 57600 baud rate hack and the DTR code removed).
    The file I'm trying to upload is quite big (1.14 Mbytes), so I can't look at all the bytes sent with a logic analyser. I think it may be a problem of clock precision, but it shouldn't as the Teensy LC is supposed to have 0.16% error at 115200 compared to the -0.2% error of the Teensy 3.2 at this baudrate.

    I've asked on the Nextion forum but got not answer, which I understand as the problem doesn't seem to come from the Nextion itself nor from the upload program of the Nextion Editor.

    I don't know what to try now, does anyone have a suggestion ?
    Last edited by Etienne; 05-11-2019 at 05:27 PM.

  5. #5
    Member Etienne's Avatar
    Join Date
    Mar 2016
    Ardeche, France
    I think I just found the solution ! : I increased the serial tx buffer size to 4096 (serial1.c, line 40).
    Weird, as the Teensy LC doesn't have a FIFO on Serial1, It shouldn't have worked with it.

  6. #6
    Junior Member
    Join Date
    May 2020
    I know this is an old thread, but I'm trying to do the same thing and having the exact same problem - hoping Etienne or anyone else familiar with this might chime in.

    I've got a Teensy 3.2 hooked up via Serial2 to a Nextion NX4024T032 3.2" display. Sending serial commands from the Teensy to control the display works great, and programming the display either via its SD card or via the Nextion editor uploader over USB through a FTDI breakout works well. However, in order to make my life easier while I fine tune the display layout in situ, being able to use the Teensy as a USB pass through from my computer would be awesome.

    I'm currently using a baud rate of 115200 (though I've tried several others with less success), and can get some code to upload to the Nextion through the Teensy when I make a minor change to it, but if it does a full upload (say after changing an image file in the display configuration) it goes through the whole transfer process to 100% and then shows a 'check error'.

    I tried changing line 40 in my Serial2.c (similar to what Etienne suggested in their previous post), but it did not solve the problem. I don't believe there's any difference between serial1 and serial2. It's so close to working, there's just something happening with the longer upload...

    Here's the code I'm using to transfer USB serial to Serial2 (connected to the Nextion):

    #define HWSERIAL Serial2  //set to Serial2 for first Nextion display
    void setup() {
    	Serial.begin(115200); //setting teensy's serial to the same baudrate as the Nextion display
    	HWSERIAL.begin(115200);//display has been set to a baudrate of 115200 previously using the Nextion editor
    void loop() {
            byte incomingByte;
    	if (Serial.available() > 0) {
    		incomingByte =;
    	if (HWSERIAL.available() > 0) {
    		incomingByte =;

  7. #7
    Junior Member
    Join Date
    Feb 2020
    Below is basically the code that I've used for some time. Works on Serial1/Serial2/Serial3 without issues. Automatically sets the max baud rate which makes for quick uploads. If you're using the Nextion Uploader then it will see the connected Teensy as a Nextion device and automatically find the correct COM port. Just hit upload and both the Nextion and Teensy will restart once the update has completed.

    Remember to close the serial monitor beforehand.

    #define CPU_RESTART_ADDR (uint32_t *)0xE000ED0C
    #define CPU_RESTART_VAL 0x5FA0004
    #define tft Serial3
    void TFT_serial_update() {
      byte s1;
      long bytecount=0;
      tft.print("page tftupdate\xFF\xFF\xFF");  //page on the Nextion that prompts to begin sending TFT file 
      tft.print("baud=921600\xFF\xFF\xFF");   //temporarily set the Nextion to the highest possible baud ratte 
      elapsedMillis ms;
    while(bytecount<30 || ms<2000)  { 
      if(Serial.available()) { 
      if(tft.available()) { 
      CPU_RESTART    // Update completed. Restart Teensy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts