ESP32-C3 serial1 not working
Posted: Wed Aug 11, 2021 2:29 pm
Hello,
I'm trying to use the second serial port on my new ESP32-C3-WROOM-02 board.
The main port UART0 is OK and I bootload the program from Arduino IDE, and I receive debug informations.
GPIO are working well to, I only need to send data from UART1 to finish my project !
The project source is from BLE_uart code example. I only added few features because all the logic comme from BT app, but the following lines doesn't do anythings:
So with this function I'm supposed to receive the raw data from bluetooth on my serial port:
This line is supposed to send data:
I receive the decimal content on the debug port, I see message counter "Serial.print(l_buffer);"
I tested to switch RX & TX pins, monitored with FTDI device or scope. The elecical level ar OK (3V3 for TX) so the port seems to be great configured.
I use the last https://raw.githubusercontent.com/espre ... index.json lib version 2.0.0-rc1
Thank you for help.
Eliott.
I'm trying to use the second serial port on my new ESP32-C3-WROOM-02 board.
The main port UART0 is OK and I bootload the program from Arduino IDE, and I receive debug informations.
GPIO are working well to, I only need to send data from UART1 to finish my project !
The project source is from BLE_uart code example. I only added few features because all the logic comme from BT app, but the following lines doesn't do anythings:
Code: Select all
//header
#define RX1 2
#define TX1 3
//setup()
Serial1.begin(115200, SERIAL_8N1, RX1, TX1);
Serial1.println("BOOT");
//function
class MyCallbacks: public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic *pCharacteristic) {
std::string rxValue = pCharacteristic->getValue();
if (rxValue.length() >= 6)
{
g_count_total_rx++;
Serial.print("Received Value: ");
char l_buffer[20] = {0};
for (int i = 0; i < 6; i++)
{
Serial.print(rxValue[i], DEC);
if(i<(rxValue.length()-1)) Serial.print("-");
}
Serial.println("");
if(rxValue[0]==0xD0 && rxValue[5]==0xFF)
{
g_time_deep_sleep = 5000; //5 secondes
g_timer_shutdown = 0; //pour mettre à jour après la déco
Serial.println("Entering deep speel mode"); //affichage sur la console
}
else
{
char l_buffer[20] = {0};
for (int i = 0; i < 6; i++) Serial1.print(rxValue[i]); //envoi à l'ECU
sprintf(l_buffer, "Count %u\r\n", g_count_total_rx);
bletx(l_buffer, strlen(l_buffer)); //en onvoi le compre à l'appli
Serial.print(l_buffer); //affichage du comte sur la console
}
}
}
};
This line is supposed to send data:
Code: Select all
for (int i = 0; i < 6; i++) Serial1.print(rxValue[i]);
I tested to switch RX & TX pins, monitored with FTDI device or scope. The elecical level ar OK (3V3 for TX) so the port seems to be great configured.
I use the last https://raw.githubusercontent.com/espre ... index.json lib version 2.0.0-rc1
Thank you for help.
Eliott.