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

Thread: Program esp32 from teensy

  1. #1
    Junior Member
    Join Date
    Oct 2020
    Posts
    2

    Program esp32 from teensy

    Hi PJRC community,

    I have an esp32-cam module and I have been using an arduino board to program it as described in this very simple tutorial https://technoreview85.com/how-to-pr...ino-uno-board/
    Now I would like to start projects with my teensy 4.0 and the esp32, and I don't want to have the arduino in the middle just to program the esp32.
    Is there a simple way to use the teensy just like the arduino to do that ?

  2. #2
    Junior Member
    Join Date
    Jun 2018
    Location
    Berlin
    Posts
    16
    Hi Julien,

    i can't answer your question. But the module has wifi. May be OTA programming makes sense?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,206
    Yes. I believe that tutorial will work with Teensy in place of the Arduino Uno, but only if you have programmed your Teensy with the USBtoSerial sketch (or similar code).

    In Arduino, first select Teensy from the Tools > Boards menu. Arduino's other menus update based on the selected board. Then click File > Examples > Teensy > USB_Serial > USBtoSerial. Upload that program to your Teensy. Once Teensy is running that code, I'm pretty sure you can use Teensy the same way as Arduino Uno is shown in that tutorial.

    Arduino Uno has a dedicated USB to serial chip, so you don't need to upload any specific code to Uno in that tutorial. The other chip on Uno already has the needed code permanently programmed. On Teensy, there is no dedicated USB to serial chip, which is why you need to load this program onto your Teensy to make that tutorial work.

  4. #4
    Junior Member
    Join Date
    Oct 2020
    Posts
    2
    Quote Originally Posted by PaulStoffregen View Post
    Yes. I believe that tutorial will work with Teensy in place of the Arduino Uno, but only if you have programmed your Teensy with the USBtoSerial sketch (or similar code).

    In Arduino, first select Teensy from the Tools > Boards menu. Arduino's other menus update based on the selected board. Then click File > Examples > Teensy > USB_Serial > USBtoSerial. Upload that program to your Teensy. Once Teensy is running that code, I'm pretty sure you can use Teensy the same way as Arduino Uno is shown in that tutorial.

    Arduino Uno has a dedicated USB to serial chip, so you don't need to upload any specific code to Uno in that tutorial. The other chip on Uno already has the needed code permanently programmed. On Teensy, there is no dedicated USB to serial chip, which is why you need to load this program onto your Teensy to make that tutorial work.
    Thanks Paul. Very informative answer.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,259
    Indeed back in the days of ESP8266 T_3.2's were used to program them. Including toggling the control pins they needed.

    Assuming the passthrough for programming is similar the indicated sketch or even customized should work well.

  6. #6
    Senior Member
    Join Date
    Jun 2018
    Location
    USA
    Posts
    198
    Hello,

    I'm trying to program an ESP32-devkit1-32e using the Teensy. Of course I can use the onboard USB connector but I'm trying to test/verify for a custom PCB.

    Here are my connections.

    Click image for larger version. 

Name:	esp32-devkitc-32e-teensy4.1-programming.jpg 
Views:	9 
Size:	195.4 KB 
ID:	26222

    Code:
    T4.1 | ESP32-devkitc-32e
    GND | GND
    3.3V | 3.3V
    RX1 (0) | GPIO1 (U0TXD)
    TX1 (1) | GPIO3 (U0RXD)
    The devikit buttons
    Code:
    EN = EN
    BOOT = GPIO0 (25 | BOOT)
    1. Program the Teensy 4.1 with File > Examples > Teensy > USB_Serial > USBtoSerial

    2. Open the ESP32 code in arduino that I'm trying to flash.

    3. Set Arduino to the the COM5 Serial (Teensy 4.1) and confirmed the settings as defined from this example (although I don't have the AVR ISP Programmer, does that matter?)

    Click image for larger version. 

Name:	arduino_settings.png 
Views:	5 
Size:	40.1 KB 
ID:	26221

    4. Run upload.

    I wind up with the following error.

    Code:
    Arduino: 1.8.16 (Windows 10), TD: 1.55, Board: "ESP32 Dev Module, Disabled, Huge APP (3MB No OTA/1MB SPIFFS), 240MHz (WiFi/BT), QIO, 40MHz, 4MB (32Mb), 115200, None"
    
    Sketch uses 899638 bytes (28%) of program storage space. Maximum is 3145728 bytes.
    
    Global variables use 30116 bytes (9%) of dynamic memory, leaving 297564 bytes for local variables. Maximum is 327680 bytes.
    
    esptool.py v3.0-dev
    
    Serial port usb:0/140000/0/4
    
    Traceback (most recent call last):
    
      File "esptool.py", line 3682, in <module>
    
      File "esptool.py", line 3675, in _main
    
      File "esptool.py", line 3329, in main
    
      File "esptool.py", line 263, in __init__
    
      File "site-packages\serial\__init__.py", line 88, in serial_for_url
    
      File "site-packages\serial\serialwin32.py", line 62, in open
    
    serial.serialutil.SerialException: could not open port 'usb:0/140000/0/4': WindowsError(123, 'The filename, directory name, or volume label syntax is incorrect.')
    
    Failed to execute script esptool
    
    the selected serial port Failed to execute script esptool
    
     does not exist or your board is not connected
    
    
    
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    If I change the port to COM 5 (Teensy).... Then I get a timeout error. I try pressing Boot, nothing. I try EN, nothing. I try Hold boot, then EN, nothing.

    Code:
    Arduino: 1.8.16 (Windows 10), TD: 1.55, Board: "ESP32 Dev Module, Disabled, Huge APP (3MB No OTA/1MB SPIFFS), 240MHz (WiFi/BT), QIO, 40MHz, 4MB (32Mb), 115200, None"
    
    Sketch uses 899638 bytes (28%) of program storage space. Maximum is 3145728 bytes.
    
    Global variables use 30116 bytes (9%) of dynamic memory, leaving 297564 bytes for local variables. Maximum is 327680 bytes.
    
    esptool.py v3.0-dev
    
    Serial port COM5
    
    Connecting........_____....._____....._____....._____....._____....._____.....____An error occurred while uploading the sketch
    
    _
    
    
    
    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
    
    
    
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    Does anyone have any advice on what I should try next?

    Jay

  7. #7
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,387
    Anno 2016 I used this to program an ESP8266 through a Teensy - i think that should work for a ESp32, too.
    (But have not tried it)

    You have to comment out the "Flexiboard" things:

    Code:
    #include <FlexiBoard.h>
    ...
      setBacklight(0);
    
      pinMode(LED_BUILTIN, OUTPUT);
      initLEDs();
    
      SETLED( ... 
    
      if ( !resetWLAN() ) { [..]
    etc.

    https://github.com/FrankBoesing/Flex...ashESP8266.ino

Posting Permissions

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