ESP32-C6 and UART1

NevynSelby
Posts: 34
Joined: Thu Dec 24, 2015 12:04 pm

ESP32-C6 and UART1

Postby NevynSelby » Sun Aug 18, 2024 11:35 am

I have an application that is derived from two of the sample applications:
  • Console application
  • UART events
I have the console working fine over USB-C, this is using the console defaults and this appears to be UART0.

The problems start when I add another UART, in this case UART1. I want this to be connected to another chip and for the C6 to process the data and then send the results over the console UART. I have removed the pattern matching from the example as I don't think I need this. The application does not appear to be receiving and events.

The code to create the UART looks like this:

Code: Select all

uart_config_t uart_config = { };
uart_config.baud_rate = (int) (_baudRate && INT_MAX);
uart_config.data_bits = _dataBits;
uart_config.parity = _parity;
uart_config.stop_bits = _stopBits;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
uart_config.source_clk = UART_SCLK_DEFAULT;

esp_err_t result;
result = uart_driver_install(UART_NUM_1, BUFFER_SIZE * 2, BUFFER_SIZE * 2, UART_EVENT_QUEUE_SIZE, &_uartQueueHandle, 0);
result = uart_param_config(UART_NUM_1, &uart_config);
result = uart_set_pin(UART_NUM_1, UART_PIN_NO_CHANGE, _rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
result = xTaskCreate(UART::Task, "UARTTask", 2048, this, 12, &_taskHandle);
Note that I have removed the error checks between each statement.

I have tried setting the _rxPin to several different pins including 4, 15, 10, 11 but none of them generate any events.

I have event just tried the events example on its own and just changed the UART from 0 to 1 and I cannot get this to work on UART1.

The baud rate is low, 115200 and I have checked the data being fed into the C6 with an oscilloscope and the data is decoding correctly.

Any suggestions would be gratefully received.

Regards,
Mark

aliarifat794
Posts: 200
Joined: Sun Jun 23, 2024 6:18 pm

Re: ESP32-C6 and UART1

Postby aliarifat794 » Mon Aug 19, 2024 2:41 pm

UART1 (i.e., _rxPin and _txPin) should be properly configured and not be used by other peripherals. Simplify your code and run a basic UART example using UART1 to verify that the hardware and software setup is correct

NevynSelby
Posts: 34
Joined: Thu Dec 24, 2015 12:04 pm

Re: ESP32-C6 and UART1

Postby NevynSelby » Mon Aug 19, 2024 4:33 pm

I have already tried moving back to the original events example from the IDF examples directory and I still see the same issue.

Regards,
Mark

Who is online

Users browsing this forum: No registered users and 99 guests