I am using Arduino as an IDF component and I am able to run code on the Metro board. I can see the ESP_LOGx messages in the "idf.py monitor" window, but I am not seeing the Serial.print() output? Where is Serial configured. I would like the Serial.print to go to the USB out, same as ESP_LOG.
Thanks
Serial.print on Adafruit ESP32S3 Metro board
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Serial.print on Adafruit ESP32S3 Metro board
Thanks, I see that but I am trying to build my app with the IDF tools (Arduino is installed as a component) but I cannot find the right setting. I get the expected result if I use the Arduino IDE, I get the expected results.
Thanks
Thanks
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Serial.print on Adafruit ESP32S3 Metro board
That link also shows the define macros you should set before you call initArduino that match the settings from the tools menu.
Re: Serial.print on Adafruit ESP32S3 Metro board
Ok that's easy to do. Do I define the macro before the call to initArduino, or should the #define be used to compile the whole component? When looking at HardwareSerial.h it looks like the define are needed when compiling the components.
Thanks
Thanks
- #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
- #ifndef ARDUINO_USB_CDC_ON_BOOT
- #define ARDUINO_USB_CDC_ON_BOOT 0
- #endif
- #if ARDUINO_USB_CDC_ON_BOOT //Serial used from Native_USB_CDC | HW_CDC_JTAG
- #if ARDUINO_USB_MODE // Hardware CDC mode
- // Arduino Serial is the HW JTAG CDC device
- #define Serial HWCDCSerial
- #else // !ARDUINO_USB_MODE -- Native USB Mode
- // Arduino Serial is the Native USB CDC device
- #define Serial USBSerial
- #endif // ARDUINO_USB_MODE
- #else // !ARDUINO_USB_CDC_ON_BOOT -- Serial is used from UART0
- // if not using CDC on Boot, Arduino Serial is the UART0 device
- #define Serial Serial0
- #endif // ARDUINO_USB_CDC_ON_BOOT
- // There is always Seria0 for UART0
- extern HardwareSerial Serial0;
- #if SOC_UART_NUM > 1
- extern HardwareSerial Serial1;
- #endif
- #if SOC_UART_NUM > 2
- extern HardwareSerial Serial2;
- #endif
- #endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
Re: Serial.print on Adafruit ESP32S3 Metro board
If I define:
target_compile_options(${COMPONENT_TARGET} PUBLIC
-DARDUINO=10812
-DARDUINO_${idf_target_for_macro}_DEV
-DARDUINO_ARCH_ESP32
-DARDUINO_BOARD="${idf_target_caps}_DEV"
-DARDUINO_VARIANT="${CONFIG_ARDUINO_VARIANT}"
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=0
-DESP32)
Then I get compilation errors:
/HardwareSerial.h:350:16: error: 'USBSerial' was not declared in this scope; did you mean 'Serial'?
350 | #define Serial USBSerial
when compiling .../cores/esp32/chip-debug-report.cpp:290:3: note: in expansion of macro 'Serial'
target_compile_options(${COMPONENT_TARGET} PUBLIC
-DARDUINO=10812
-DARDUINO_${idf_target_for_macro}_DEV
-DARDUINO_ARCH_ESP32
-DARDUINO_BOARD="${idf_target_caps}_DEV"
-DARDUINO_VARIANT="${CONFIG_ARDUINO_VARIANT}"
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=0
-DESP32)
Then I get compilation errors:
/HardwareSerial.h:350:16: error: 'USBSerial' was not declared in this scope; did you mean 'Serial'?
350 | #define Serial USBSerial
when compiling .../cores/esp32/chip-debug-report.cpp:290:3: note: in expansion of macro 'Serial'
Who is online
Users browsing this forum: Bing [Bot] and 37 guests