I'm trying to initialize GPIOs 13 and 9 as RX and TX pins respectively for UART 1. This is resulting in an Illegal Instruction followed by device reboot for some reason.
My code for setting up the UART driver is as follows.
Code: Select all
gpio_set_direction(RXD1, GPIO_MODE_INPUT_OUTPUT);
gpio_set_direction(TXD1, GPIO_MODE_INPUT_OUTPUT);
xUartSendQueue = xQueueCreate(QUEUE_SIZE, sizeof(uint8_t));
xUartReceiveQueue = xQueueCreate(QUEUE_SIZE, sizeof(uint8_t));
if(xUartReceiveQueue == NULL)
{
ESP_LOGE(TAG, "networkTCPServe: Failed to create receive Queue");
}
uart_config_t uart_config =
{
.baud_rate = atoi(baudrate),
.data_bits = UART_DATA_8_BITS,
.parity = atoi(paritybits),
.stop_bits = atoi(stopbits),
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 122,
};
uart_param_config(UARTNUM, &uart_config);
uart_set_pin(UARTNUM, TXD1, RXD1,UART_PIN_NO_CHANGE ,UART_PIN_NO_CHANGE);
ESP_LOGE(TAG, "serialInit: Serial connection initialized");
if (uart_driver_install(UARTNUM, QUEUE_SIZE * 2, QUEUE_SIZE * 2, 10, &UARTqueue, 0) == ESP_OK)
{
ESP_LOGI(TAG, "serialInit: Driver install complete");
}