Hi
Disclaimer: yes, I’ve been through a lot of posts, but that did not help me (there must be something I dont get, therefore I hope for your help).
I am trying to understand how to see the text my program show through Serial, Serial0, Seria1 and Serial2 objects on the wemos LOLIN esp32-s3 board.
Using platformio on linux, minicom and my own USB-serial port bought at adafruit to try to connect to the various serial ports, here what I see
- I get nothing from the USB ports of the board
- if I put my adafruit serial pins on the pins of UART0 of the boards, I get this, which tends to prove I can get something out of the printf function.
So what do I need to do to see these Serial object actually do output something?
Thanks.
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a80
entry 0x403c98d0
printf
msg:HIGH
msg:LOW
(etc)
but nothing is visible from what my code sends through Serial, Serial0, Serial1 even when putting my adaftuit serial pins on the right pins for uart1 (17,18)
My code
#include <Arduino.h>
#define MYLED 4
#ifndef MYLED
#define MYLED LED_BUILTIN
#endif
void println(const String &s)
{
printf("msg:%s\n",s.c_str());
Serial.println(s);
Serial0.println(s);
Serial1.println(s);
Serial2.println(s);
}
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin MYLED as an output.
delay(2000);
// while(! Serial);
pinMode(MYLED, OUTPUT);
Serial.begin(9600);
Serial1.begin(9600);
Serial2.begin(9600);
Serial.println("HIGH");
digitalWrite(MYLED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2000);
}
int freq=1024;
bool decrease=true;
int nbflash=0;
// the loop function runs over and over again forever
void loop() {
Serial.println("Serial no #");
Serial0.println("Serial 0");
Serial1.println("Serial 1");
Serial2.println("Serial 2");
printf("printf\n");
println("HIGH");
digitalWrite(MYLED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(freq); // wait for a second
println("LOW");
digitalWrite(MYLED, LOW); // turn the LED off by making the voltage LOW
delay(freq); // wait for a second
nbflash = (nbflash+1)%4;
if(nbflash ==0)
{
if(decrease)
{
if(freq<=64) decrease=false;
else freq /=2;
}
else
{
if(freq>=2048) decrease=true;
else freq *=2;
}
}
}
My platformio.ini
[env:lolin_s3]
platform = espressif32
board = lolin_s3
framework = arduino
; change microcontroller
board_build.mcu = esp32s3
; change MCU frequency
board_build.f_cpu = 240000000L
upload_protocol = esptool
upload_port = /dev/ttyACM0
debug_tool = esp-prog
debug_port = /dev/ttyUSB0
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1