-
Notifications
You must be signed in to change notification settings - Fork 7.7k
-
I need to be able to use the USB serial device in download mode and have a Serial device via USB. As per discussions and this bug report, one cannot have TinyUSB CDC running, or the ESP does not reset out of the bootloader.
As per the ESP-IDF documentation, I can configure printf to print using the ROM Serial in the USB-JTAG peripheral:
#include "esp_vfs_dev.h"
#include "esp_vfs_cdcacm.h"
#include "esp_vfs_usb_serial_jtag.h"
#include "driver/usb_serial_jtag.h"
#define PRINTF_USB printf
void configJtagSerialUSB(){
setvbuf(stdin, NULL, _IONBF, 0);
// /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
esp_vfs_dev_usb_serial_jtag_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
// /* Move the caret to the beginning of the next line on '\n' */
esp_vfs_dev_usb_serial_jtag_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
// /* Enable non-blocking mode on stdin and stdout */
fcntl(fileno(stdout), F_SETFL, 0);
fcntl(fileno(stdin), F_SETFL, 0);
usb_serial_jtag_driver_config_t usb_serial_jtag_config = (usb_serial_jtag_driver_config_t){512,256};
// /* Install USB-SERIAL-JTAG driver for interrupt-driven reads and writes */
esp_err_t ret = usb_serial_jtag_driver_install(&usb_serial_jtag_config);
if (ret != ESP_OK) {
}
}
This works well if I want to use printf, but how would I go about using it if I wanted to write binary data? Is there a way to map the Arduino Serial objects to the ROM serial?
Will I have to use the IDF functions like
usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_to_wait);
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment