AnsweredAssumed Answered

STM32F411 HAL USART Polling receiving garbled characters

Question asked by pinkman on Mar 2, 2015
Latest reply on Mar 2, 2015 by AvaTar
I have a project configured the same as the `UART_Hyperterminal_DMA` example from the `STM32Cube_FW_F4_V1.4.0`.

I am reading NMEA strings from a GPS device.

When I print byte-by-byte over virtual com (which I have confirmed works) I receive something that looks like this:

$GMCV,,,,,,*D
$GVT,,,,,,N*E
$NGA,,,,000999,,,*5
GNSA,1,,,,999,.999
$GSA,,,,,,9,9999.9E
$PGV,,10079
$LV,10*
NG,,,,NA
 
 
$RM,V,,,,ND
VT,,,,N*
GNA,,,,0999,,6
GNA,1,,,,,9.9,9.9,9.9*E
$GGS,A1,,,,,,,9999999999992
GPSV,10*
L,1,5
GNL,,V,7AAAAAAAA$G,,,,,,,4D$G,,,,,N2
GNGA,,,,,0,9.,,,*6
$GGS,A1,,,,,,,9999999999*2
GNSAA,,,,,,,,9.,9999.*
PG,10*

I am using FreeRTOS.

I have checked:
       
  • clock settings for USART1 bus are correct.
  •    
  • signals from gps with a logic analyzer are correct.
Here is a bit of my code:

void USART::task(void const *nothing) {
 
  HAL_StatusTypeDef status;
 
  status = HAL_UART_Receive(&huart1, (uint8_t *) aRxBuffer, RXBUFFERSIZE, 100);
 
 
  osMessagePut(usartQueue, aRxBuffer[0], 0);
 
  printf("%c", aRxBuffer[0]);
 
  while ((status != HAL_OK) || (status != HAL_TIMEOUT)) {
 
    status = HAL_UART_Receive(&huart1, (uint8_t *) aRxBuffer, RXBUFFERSIZE, 100);
 
    printf("%c", aRxBuffer[0]);
 
    osMessagePut(usartQueue, aRxBuffer[0], 0);
 
  }
 
}
 
extern "C" {
 
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
 
 
}
 
}


Would really appreciate any help.

Thanks!

Outcomes