EDIT: Solved, Problem was with not sending "\r\n" at the end of the sentence.

I'm trying to control Adafruit Ultimate GPS through STM32F407, there is an official Arduino Library and this library has a sendCommand() function. I'm trying to implement this sendCommand() function in Keil using HAL library

// arduino command for setting antenna off
GPS.sendCommand("$PGCMD,33,0*6D\n");  In keil I wrote these lines uint8_t Tx_Buffer[100]; int size; // Turn off antenna update nuisance data size = sprintf(Tx_Buffer,"$PGCMD,33,0*6D\n");
HAL_UART_Transmit(&huart1, Tx_Buffer, size, 100);
HAL_Delay(100);

// Set the update speed
size = sprintf(Tx_Buffer,"$PMTK220,500*2B\n"); HAL_UART_Transmit(&huart1, Tx_Buffer, size, 100); HAL_Delay(100); // Request RMC and GGA sentences only size = sprintf(Tx_Buffer,"$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\n");
HAL_UART_Transmit(&huart1, Tx_Buffer ,size, 100);
HAL_Delay(1000);


However, it seems that I am not changing anyting because it is still giving data in defaults settings. UART Baudrate is 9600 (Transmit and receive)

Can you help me with the C code? Thanks in advance.

• You're missing a '\n' on the end of your 'Set the update speed' command. – brhans May 7 '18 at 20:29
• Thank you for your response. I tried it before, just missed it at last run. In addition I tried running it with "\n\r" too. – Zed K. May 8 '18 at 4:54
• @ZiyaKeskin “\n\r” would be very uncommon. Typically either “\n” or “\r\n”. – Blair Fonville May 8 '18 at 4:56
• I just tried it with "\r\n", and it is working. Thanks for your responses. – Zed K. May 8 '18 at 5:38
• Please post an answer containing exactly that information, @ZiyaKeskin. It will allow us to recognize this question as answered, and will thus help others more, and as a bonus, you can earn more reputation points that way. – Marcus Müller May 9 '18 at 17:07