2019-03-01 02:14 AM
Hi
I am sending a AT command through USART2 -
char CGSN[] = "AT+CGSN\r\n";
HAL_UART_Transmit(&huart2,(uint8_t *)CGSN, sizeof(CGSN),100);
HAL_Delay(500);
HAL_UART_Receive_IT(&huart2,(uint8_t *)&ch,1);
I am receiving ch in callback and storing each byte in a buffer
the response stored in buffer is - \r\n9876543212345\r\n\r\nOK\r\n
how do i filter out n" 9876543212345 "and "OK" and store in separately array
Thanks & Regards
2019-03-01 03:19 AM
You can use the standard C "strtok" function for example.
Also this question is not related to STM32, it's a general C language question.
2023-10-11 11:31 AM
Can you please send a code for the same things because I working the same but using the DMA method but gsm doesn't reply for AT commands
2023-10-11 11:49 AM
Debug the code using polled or IRQ methods.
Modem can respond immediately so no random delays, be prepared to get data back. If modem not responding check UART connection to correct pins and baud rates, and is powered up properly.