Are you saying when I compile my sketch for the ESP32 I must select the Teensy Micromod as the procesor, not “ESP32 Dev Module”?
Yep (note in that guide example they are using an artemis MM)
OK … but very weird !
I’ll give it a go later today, and let you know
thanks
Just to be extra clear:
I am compiling sketch A for the ESP32 connected to my PC on COMxx and the comipled sketch is then uploaded over COMxx connected to the ESP32 USB-C port and on into the ESP32-WROOM-32E chip and it will then respond to serial requests from the Micromod teensy (running another sketch B) over Serial 1 or 2?
No. Like the mainboard guide, you upload code as described over the mainboard’s usbc port, which puts the sketch (that talks to the esp32 function board over serial) on the teensy-run memory on the mainboard
Do not use the function on board usbc port for anything other than changing firmware, which is not recommended unless you’re doing something extraordinarily specific
Hook it up just like the guide but use Teensy MM as the board…and you can run the generic eap32 serial test (per the teensy’s pins/buses)
Basically: leave the esp32 function board alone
Sorry, too late to "leave the ESP32 alone "
Do I need to reload the “factory” Sparkfun firmware to my ESP32 as explained here ?
The Sparfun-provided firmware in my ESP32 was overridden well before I started this thread. I compiled using processor selection “ESP32 Dev Module” and uploaded the sketch in my second post for this thread. My sketch ran fine on the ESP32 and successfully echoed any text I sent over bluetooth to “Serial” (i.e. the USB-C/firmware update port) and vice versa.
I simultaneously ran a simple sketch on the MM Teensy to echo Serial <> Serial2 and vice versa.
However I could never get any text to echo over Serial2 (see OUTPort in my ESP32 sketch).
Also, when I tested the sketches in your first post in this thread (which is functionally very simlar to my sketch) I compiled for the “ESP32 Dev Module” processor and uploaded to the ESP32 via USB-C.
PS: I wish the posts were numbered in this forum
Yep…the good news is it should be fine after
Just FYI the posts are numbered while viewing/scrolling as the appended number in the address bar
OK I’ve successfully flashed with “factory_WROOM-32.bin” and get the expected response to: AT+GMR command over Serial2. (running sketch below on Micromod Teensy)
But this is where I got stuck 2 months ago and resorted to loading a sketch onto the ESP32 (overridding the firmware). How can I get the ESP32 to echo Serial Bluetooth text through Serial2 and vice versa?
Unrelated question: I can’t find the code insertion button anymore (it must have worked at my post #3 above). How do I insert code now, so it appears with nice C++ structure?
Thanks
/* For MM Teensy assembly.
Purpose is simply to echo serial data from the MM ESP 32 to the Teensy’s Serial monitor (Serial), and vice versa
The Serial port to the ESP32 depends on which slot it is in:
use Serial1 when the ESP32 is in F0 slot
use Serial2 when the ESP32 is in F1 slot
Tested Micromod assembly 27/9/24 - working OK
*/
#include <Streaming.h>
//efine ESP Serial1 // for ESP32 in F0
#define ESP Serial2 // for ESP32 in F1
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 1000);
Serial << “\n\n======= t4_echo_ESP32.F ======\n”;
Serial << " * Open serial port to ESP32: ";
delay(500);
ESP.begin(115200);
while (!ESP && millis() < 1000);
if (ESP) Serial << “OK\n”;
else Serial << “** BAD **\n”;
ESP.flush();
Serial << “--------- setup done ---------\n”;
delay(1000);
}
void loop() {
if (Serial.available()) { ESP.write(Serial.read()); }
if ( ESP.available()) { Serial.write( ESP.read()); }
//delay(10);
}
I have a solution, but not using ESP-AT firmware or AT commands.
I decided to revisit my earlier (failed) experiment that over-writes the firmware with my sketch built using the IDE for “ESP32 Dev Module”.
The one piece of information i was missing was a specific use of Serial2.begin instruction to specify the exact ESP32 pins providing RX/TX for Serial2:
#define RXD2 16
#define TXD2 17
#define teensy Serial2
teensy.begin(115200,SERIAL_8N1,RXD2,TXD2);
Below is my working sketch. It provides bi-directional three way data echo:
from ESP32 Serial to Bluetooth Serial, and teensy
from Bluetooth Serial to ESP32 Serial, and teensy
from teensy to Bluetooth Serial and ESP32 Serial
and vice-versa.
#include <Streaming.h>
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig`
#endif
BluetoothSerial BT;
#define RXD2 16
#define TXD2 17
#define teensy Serial2 // ESP32 port to MM Teensy processor
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 1000);
Serial << "\n\n======== ESP32_triple_echo_BT.i ========\n";
Serial << " * Open Serial2 to Teensy : ";
teensy.begin(115200,SERIAL_8N1,RXD2,TXD2);
while (!teensy && millis() < 1000);
if (teensy) Serial << "OK\n";
else Serial << "** BAD **\n";
Serial << " * Init BT (on 'ESP32_AT'): "; // default name for ESP32
BT.begin("ESP32_AT"); // default Bluetooth device name
if (BT) Serial << "OK\n";
else {Serial << "FAILED ** program HALTED **\n"; while(true){}; }
Serial << "------ setup done ------\n";
}
void loop() {
if (Serial.available()) {
char a = Serial.read();
BT.write(a);
teensy.write(a); // also copy to teensy
}
if (BT.available()) {
char b = BT.read();
Serial.write(b);
teensy.write(b); // also copy to teensy
}
if (teensy.available()) {
char c = teensy.read();
Serial.write(c);
BT.write(c);
}
}