Read NMEA Data via UART STM32
Hello
I am currently working on a microcontroller project I am building a GPS tachometer which transfers the NMEA data of the GNSS 4 Click Module from Mikroe via UART to my STM32L052K6T6 and outputs it to a display
I have so far UART initialized with the BAUD rate and so on my question is now how can I read the NMEA data correctly from the USART1->DRD (data register) so that I can store a readable string in a variable and output it to a display
I have as far as the data register is stored in a char this is correct ? how can I read the NMEA data from it ? I am still a beginner in this topic...
Below you can see my code, which I already have
I would be very grateful for any help :D
void USART1_IRQHandler(void)
{
char data;
//check if we are here because of RXNE interrupt
if ((USART1->ISR & USART_ISR_RXNE) == USART_ISR_RXNE) //if RX is not empty (Received character ?)
{
data = (uint8_t)USART1->RDR; //Receive data, clear flag
while (!(USART1->ISR & USART_ISR_TC));
// ... make your stuff with the received byte(s)
USART1->ICR = USART_ICR_TCCF; // Clear TC flag
USART1->CR1 = USART_CR1_TCIE; // Enable TC interrupt
lcdWriteNumberPos(2, 9, "%.2f", data);
lcdWriteStringPos(2, 12, "km/h");
}
//check if we are here because of TXEIE interrupt
if (USART1->ISR & USART_ISR_TXE) //if TX is not empty
{
//handle transmit completion here
}
}
