Skip to content

Commit

Permalink
Fix UART driver install (#2116)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored Oct 20, 2021
1 parent b22fe92 commit 051268f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
24 changes: 11 additions & 13 deletions targets/ESP32/_common/WireProtocol_HAL_Interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,16 @@ bool WP_Initialise(COM_HANDLE port)

ASSERT(WP_Port <= SOC_UART_NUM);

uart_config_t uart_config = {
// baudrate
.baud_rate = TARGET_SERIAL_BAUDRATE,
// baudrate
.data_bits = UART_DATA_8_BITS,
// parity mode
.parity = UART_PARITY_DISABLE,
// stop bit mode
.stop_bits = UART_STOP_BITS_1,
// hardware flow control(cts/rts)
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};
uart_config_t uart_config = {// baudrate
.baud_rate = TARGET_SERIAL_BAUDRATE,
// baudrate
.data_bits = UART_DATA_8_BITS,
// parity mode
.parity = UART_PARITY_DISABLE,
// stop bit mode
.stop_bits = UART_STOP_BITS_1,
// hardware flow control(cts/rts)
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE};

uart_param_config(WP_Port, &uart_config);

Expand All @@ -70,7 +68,7 @@ bool WP_Initialise(COM_HANDLE port)
UART_PIN_NO_CHANGE);

// setup UART driver with UART queue
uart_driver_install(WP_Port, 256, 256, 0, NULL, 0);
uart_driver_install(WP_Port, 256, 256, 0, NULL, ESP_INTR_FLAG_IRAM);

WP_Port_Intitialised = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,14 @@ HRESULT Library_sys_io_ser_native_System_IO_Ports_SerialPort::NativeInit___VOID(
// Install driver
esp_err = uart_driver_install(
uart_num,
UART_BUFER_SIZE, // rx_buffer_size,
0, // tx_buffer_size, not buffered
20, // queue_size
&(palUart->UartEventQueue), // QueueHandle_t *uart_queue ( none for now )
0 // intr_alloc_flags
);
// rx_buffer_size
UART_BUFER_SIZE,
// tx_buffer_size, not buffered
0,
// queue_size
20,
&(palUart->UartEventQueue),
ESP_INTR_FLAG_IRAM);
if (esp_err != ESP_OK)
{
ESP_LOGE(TAG, "Failed to install uart driver");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,16 @@ HRESULT Library_win_dev_serial_native_Windows_Devices_SerialCommunication_Serial
// Install driver
esp_err = uart_driver_install(
uart_num,
UART_BUFER_SIZE, // rx_buffer_size,
0, // tx_buffer_size, not buffered
20, // queue_size
&(palUart->UartEventQueue), // QueueHandle_t *uart_queue ( none for now )
0 // intr_alloc_flags
);
// rx_buffer_size,
UART_BUFER_SIZE,
// tx_buffer_size, not buffered
0,
// queue_size
20,
// QueueHandle_t *uart_queue ( none for now )
&(palUart->UartEventQueue),

ESP_INTR_FLAG_IRAM);
if (esp_err != ESP_OK)
{
ESP_LOGE(TAG, "Failed to install uart driver");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool oneWireInit()
UART_PIN_NO_CHANGE,
UART_PIN_NO_CHANGE) != ESP_OK)
return false;
if (uart_driver_install(UartDriver, UART_FIFO_LEN * 2, 0, 0, NULL, 0) != ESP_OK)
if (uart_driver_install(UartDriver, UART_FIFO_LEN * 2, 0, 0, NULL, ESP_INTR_FLAG_IRAM) != ESP_OK)
return false;

#if (ONEWIRE_USE_MUTUAL_EXCLUSION == TRUE)
Expand Down

0 comments on commit 051268f

Please sign in to comment.