2017-07-19 02:10 PM
I have a circuit that requires the receiver to be disabled when transmitting and the transmitter disabled while receiving. I seem to be having trouble re-enabling the receiver after transmitting a packet of data.
I do not get any UART interrupts on the next receive event. I have trapped it with the debugger and the UART register shows the receiver is enabled, the receive interrupt is enabled, and the uart is enabled. The only thing I do not see is the REACK flag set. If I try to sit in a loop until REACK is set, I end up in a infinite loop.
I can receive a packet, switch to transmit and send a packet, but I am unable to successfully switch back into a valid receive mode. This is all part of a exchange of data without any gaps between packets and I am not going to sleep between packets.
Processor: STM32L011
Module: LPUART1
void enable_uart_transmitter(void)
{
LPUART1->CR1 |= ( USART_CR1_TXEIE | USART_CR1_TE );
}
void disable_uart_transmitter(void)
{
LPUART1->CR1 &= ~(USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_TE);
}
void enable_uart_receiver(void)
{
LPUART1->CR1 |= ( USART_CR1_RXNEIE | USART_CR1_RE );
}
void disable_uart_receiver(void)
{
LPUART1->CR1 &= ~( USART_CR1_RXNEIE | USART_CR1_RE );
}
Solved! Go to Solution.
2017-07-20 07:04 AM
Problem solved.
Issue relating the UART RX set to GPIO during TX but never switched back to alternate mode during receive period.
2017-07-20 07:04 AM
Problem solved.
Issue relating the UART RX set to GPIO during TX but never switched back to alternate mode during receive period.