LOAD Wifi manger ESP32 direct from Teensy4

pd0lew

Well-known member
Hi all,

This is the situation, on my Power meter build with Teensy4, I installed also a ESP32 to get wireless all data the ESP32 and Teensy4 works perfectly and I can load the firmware for the ESP32 via pass trough to the ESP32.

The idea is to put the Wifimanger code directly into the Teensy and send the code one time to the ESP32, after that I can use over the air updates to load a sketch with a single BIN file. Over the air is also tested and works. This is what I did already .... I sniff with a second ESP32 the data stream from the serial between Teensy Serial1 and Serial0 from the ESP32 and get the data. So is there a other way to do this. For all my users I like to have from the Teensy one HEX file so that they can load with ease new firmware and update the ESP32 with new firmware.

Best,
Johan
 
The code below works as passthrough to load the ESP32 via a Teensy 4.0 perhaps some people can help for my question.



Code:
#define EN 22 //  EN   ESP32  to pin 22 of T4.x
#define IO0 2  // IO0  ESP32  to pin 2  of T4.x

char s_dtr = 1, s_rts = 1;
char old_s_dtr = 1, old_s_rts = 1;

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
  pinMode(IO0, OUTPUT);
  pinMode(EN, OUTPUT);
  digitalWrite(IO0, HIGH);
  digitalWrite(EN, HIGH);
}

void loop() {

  if (Serial.available()) {        // If anything comes in Serial (USB),
    Serial1.write(Serial.read());  // read it and send it out Serial1 (pins 0 & 1)
  }

  if (Serial1.available()) {       // If anything comes in Serial1 (pins 0 & 1)
    Serial.write(Serial1.read());  // read it and send it out Serial (USB)
  }
  s_dtr = Serial.dtr();
  s_rts = Serial.rts();
  if(s_dtr != old_s_dtr){
    old_s_dtr = s_dtr;
    if (s_dtr != 0) digitalWrite(IO0, LOW);

    else  
      digitalWrite (IO0, HIGH);

  }
  if(s_rts != old_s_rts){
    old_s_rts = s_rts;
    if (s_rts != 0) digitalWrite(EN, LOW);
    else {
      delay(2);
      digitalWrite (EN, HIGH);
    }      
  }
}
 
Back
Top