Page 1 of 1

Setting UART Pins Issue

Posted: Tue Jul 24, 2018 12:20 pm
by mpulis
Hi all,

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");
}
I've attached an image capture of my logging screen as well. I have already previously set up GPIOs 4 and 36 as RX and TX pins for UART1 without any problems, but I needed to change the pins for a new board configuration.

Re: Setting UART Pins Issue

Posted: Tue Jul 24, 2018 3:17 pm
by WiFive
Note that GPIO6-11 are usually used for SPI flash.
https://docs.espressif.com/projects/esp ... /gpio.html