Code: Select all
void UART_Init(void)
{
/* Configure parameters of an UART driver,
* communication pins and install the driver */
uart_config_t uart_config =
{
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};
uart_param_config(UART_NUM_0, &uart_config);
// Set UART pins using UART0 default pins i.e. no changes
uart_set_pin(UART_NUM_0,U0_TX_PIN,U0_RX_PIN,U0_DTS_PIN,U0_RTS_PIN);
uart_driver_install(UART_NUM_0,U0_RX_BUF, U0_TX_BUF,U0_QUEUE_BUF, &uart0_queue, 0);
uart_enable_intr_mask(UART_NUM_0,UART_RXFIFO_TOUT_INT_ENA);
uart_isr_register(UART_NUM_0,(void*)UARTO_IRQHandle,NULL,ESP_INTR_FLAG_LEVEL6,NULL);
uart_isr_free(UART_NUM_0);
}
void UARTO_IRQHandle(void)
{
uart_clear_intr_status(UART_NUM_0,UART_RXFIFO_TOUT_INT_ENA);
while(1);
}
Code: Select all
void Send_TASK()
{
while(1)
{
printf("test\r\n");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void app_main(void)
{
UART_Init();
xTaskCreate(Send_TASK,"send_task",1024,NULL,1,NULL);
}