Setting UART Pins Issue

mpulis
Posts: 57
Joined: Mon Aug 07, 2017 7:53 am

Setting UART Pins Issue

Postby mpulis » Tue Jul 24, 2018 12:20 pm

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.
Attachments
Capture.PNG
Capture.PNG (33.93 KiB) Viewed 4319 times

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Setting UART Pins Issue

Postby WiFive » Tue Jul 24, 2018 3:17 pm

Note that GPIO6-11 are usually used for SPI flash.
https://docs.espressif.com/projects/esp ... /gpio.html

Who is online

Users browsing this forum: No registered users and 107 guests