cancel
Showing results for 
Search instead for 
Did you mean: 

Issue re-enabling LPUART1 receiver?

Nick McKendree
Associate II
Posted on July 19, 2017 at 23:10

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 );

}

1 ACCEPTED SOLUTION

Accepted Solutions
Nick McKendree
Associate II
Posted on July 20, 2017 at 16:04

Problem solved. 

Issue relating the UART RX set to GPIO during TX but never switched back to alternate mode during receive period. 

View solution in original post

1 REPLY 1
Nick McKendree
Associate II
Posted on July 20, 2017 at 16:04

Problem solved. 

Issue relating the UART RX set to GPIO during TX but never switched back to alternate mode during receive period.