-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usb_serial_jtag_ll_write_txfifo() not working with ESP_LOGI (IDFGH-11493) #12620
Comments
Do you by any chance have CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG enabled? If yes, this would mean that you are trying to use usb_serial_jtag peripheral both via the low-level functions and at the same time via the higher-level console driver — which is a combination which is unlikely to work. |
@igrr nope i have not enable it. this is my sdkconfig file. |
@igrr For me the usb_serial_jtag_read_bytes(rxbuf,64,0); didint work it was not reaidng any input thats the reason i used the low level, everything works fine if i do esp_log_level_set("*",ESP_LOG_NONE); |
Could you post the original code (with usb_serial_jtag driver, not the LL code) which didn't work? Also, please mention the IDF version ( |
@nikhil-robinson well the LL code works for me using ESP_LOGI, see below. However, rxcnt returned by
|
@jetpax Sorry for not being clear. When I wrote that this is unlikely to work, I meant that you are doing something that is unsupported. Although it might end up working in some scenarios, but in general we don't guarantee it will. Essentially you have two pieces of code in the system accessing the same underlying layer without any coordination:
As I wrote in #12605 (comment) — you have to decide whether you want to control the USB_SERIAL_JTAG peripheral using the higher-level stdio functions or using the driver, and use just one of the two approaches. Also it is highly recommended to use the usb_serial_jtag driver instead of the underlying LL functions. (Let's continue discussing your use case back in #12605. Looks like @nikhil-robinson's scenario might be different, as CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED isn't enabled in his application.) |
My original usb_jtag_code. #include <stdio.h>
#include "driver/usb_serial_jtag.h"
#include "esp_vfs_usb_serial_jtag.h"
#include "esp_vfs_dev.h"
#include <fcntl.h>
static void initUart() {
/* Disable buffering on stdin */
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
/* 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_config.rx_buffer_size = 4096;
usb_serial_jtag_config.tx_buffer_size = 4096;
esp_err_t ret = ESP_OK;
/* Install USB-SERIAL-JTAG driver for interrupt-driven reads and writes */
ret = usb_serial_jtag_driver_install(&usb_serial_jtag_config);
if (ret != ESP_OK) {
return;
}
/* Tell vfs to use usb-serial-jtag driver */
esp_vfs_usb_serial_jtag_use_driver();
}
static void Receive_callback(void *argument)
{
uint8_t rxbuf[4096];
size_t idx = 0;
char ch;
for (;;)
{
idx = usb_serial_jtag_read_bytes(rxbuf, 4096, 0);
if(idx)
{
rxbuf[idx] ='\0';
printf("RECIVED [%d] bytes: %s\n",idx, rxbuf);
}
vTaskDelay(1);
}
}
void app_main(void)
{
initUart();
xTaskCreate(Receive_callback,"UART receive callback",4096 *2,NULL,5,NULL); // receiving commands from main uart
} This was not working on this idf version : but i recently update my idf to latest release 5.1 (v5.1.2-89-g5c61c89308) and there it works |
@igrr regarding usb_jtag_serial i am also facing one issue with the esp32h2 module.
|
Answers checklist.
General issue report
When wring a buffer through usb_serial_jtag_ll_write_txfifo() if ESP_LOGI is present it is not updating the buffer to serial.
This works
This Doesn't work
The text was updated successfully, but these errors were encountered: