0

I am using STM32F103C8T6 board and CubeMX to generate the code. I need to receive the GPS data from Quectel L89 module from UART2 port. when I try that I get some junk values only... I am using HAL_UART_Receive to receive data and print it in the putty console. Any help would be greatly appreciated.

This is my code.

void task1(void)
{


char *buffer = NULL;
  buffer = (char*)malloc(400 * sizeof(char));
  while(1)
  {
  HAL_UART_Receive(&huart2,buffer,350,500);
  int size = strlen(buffer);

  HAL_UART_Transmit(&huart1,buffer,size,500);
  HAL_Delay(1000);
  }

}

Image of the Result

Vignesh
  • 55
  • 3
  • 12
  • Uart and junk values - it's quite possible your baudrate is incorrect. It's also possible the protocol isn't text based, so there's no meaningful text to display. Code up there is VERY short, and doesn't have much meaningful info for us. Lastly, what have you tried yourself so far? – domen May 08 '19 at 08:10
  • Add your full code here to get help in minimal time. – Vaibhav May 10 '19 at 06:42

1 Answers1

0

try this

HAL_UART_Receive(&huart2,(uint8_t *)buffer,350,500);

and

HAL_UART_Transmit(&huart1,(uint8_t *)buffer,size,500);

Because arguments needed for HAL functions are of uint8_t * type.

Vaibhav
  • 198
  • 1
  • 7