NUCLEO-STM32U083RC HAL_UART_Receive reads nothing
Hi all,
I have recently purchased a U083RC core and I am having problems reading data using USART1 under Single Wire (Half-duplex mode).
I am connecting to a sensor that only uses a single wire to send and receive data using a custom protocol running at 1200 bits/s. To send data I put the TX on the pin using these commands:
__HAL_UART_DISABLE(uart_pin->uart);
MODIFY_REG(uart_pin->uart->Instance->CR2, USART_CR2_SWAP, UART_ADVFEATURE_SWAP_DISABLE);
__HAL_UART_ENABLE(uart_pin->uart);
res = HAL_UART_Transmit(uart_pin->uart, (uint8_t *)cmd, cmd_len, 1000);
And this works as expected
The problem comes when I want to read the sensor data. In this case I change the pin to RX using this code
__HAL_UART_DISABLE(uart_pin->uart);
MODIFY_REG(uart_pin->uart->Instance->CR2, USART_CR2_SWAP, UART_ADVFEATURE_SWAP_ENABLE);
__HAL_UART_ENABLE(uart_pin->uart);
But when I use the method HAL_UART_Receive(uart_pin->uart, &c, 1, 110); it always returns HAL_TIMEOUT.
I don't know what's going on because on a STM32L0 this code works fine, it's when I switch to the STM32U0 that the module doesn't read anything.
Any idea what could be going on?
Thanks
