rocko445
rocko445

Reputation: 127

Where do I read data from UART?

In my EFM32LG controller I receive UART data from PORT C pin 1 as shown in the table below, which is taken from EFM32LG data sheet. I would like to read the whole byte and decide what LED to blink depending on the received byte.

Where can I see the whole received byte?

The data sheet is available here.

enter image description here

Upvotes: 0

Views: 156

Answers (1)

elliptic_hyperboloid
elliptic_hyperboloid

Reputation: 303

You can read the first byte of the received data from from the USARTn_RXDATA register. The registers and functionality of the USART unit are described starting on page 447 of this reference manual. You can also learn more about programming the EFM32 from the Silabs getting started guide.

I am not familiar with the EFM32, but from the datasheet it would look something like this:

uint8_t read_byte = USART0->RXDATA;

It is important that you enable the USART receiver first by setting the RXEN bit.

USART0->CMD = USART0->CMD | (1 << RXEN);

Upvotes: 1

Related Questions