Question
UART communication with HAL , issue in sending or receiving long data .STM32f103c8
char test[10]="beforeAT\n";
char ATcommand[100];
uint8_t ATisOK = 0;
.......................................................... (Other required HAL initiallisation code etc,. i couldn't add due to limit in posting on ST forum.)
int main () {
while(!ATisOK)
{
sprintf(ATcommand,"AT\r\n");
// HAL_UART_Transmit(&huart2,(uint8_t *)ATcommand,strlen(ATcommand),1000);
HAL_UART_Transmit(&huart1,(uint8_t *)ATcommand,strlen(ATcommand),1);
HAL_UART_Receive (&huart1, rx_buffer, 10, 10);
// HAL_UART_Receive (&huart1, rx_buffer, 100, 2000);
// HAL_UART_Transmit(&huart2,(uint8_t *)test1,strlen(test1),1000);
if(strstr((char *)rx_buffer,"OK"))
{
ATisOK = 1;
// HAL_UART_Transmit(&huart2,(uint8_t *)test2,strlen(test2),1000); // just to verify that code working or not
// HAL_UART_Transmit(&huart3,rx_buffer,sizeof(rx_buffer),1000); // AT OK RESPONSE
HAL_UART_Transmit(&huart2,rx_buffer,sizeof(rx_buffer),1);
}
// else HAL_UART_Transmit(&huart2,rx_buffer,sizeof(rx_buffer),50);
// HAL_Delay(1000);
memset(rx_buffer,0,sizeof(rx_buffer));
}
sprintf(ATcommand2,"AT+HTTPPARA=\"CONTENT\",\"application/json\r\n");
// HAL_UART_Transmit(&huart2,(uint8_t *)ATcommand2,strlen(ATcommand2),1000);
HAL_UART_Transmit(&huart1,(uint32_t *)ATcommand2,strlen(ATcommand2),116);
HAL_UART_Receive(&huart1,(uint32_t *)&gsm_buffer,112,115);
HAL_UART_Transmit(&huart2, (uint32_t *)gsm_buffer, sizeof(gsm_buffer), 6);
}Only AT command response, OK, is getting correctly but other long command, is not working properly. Any how i could fix AT+HTTPINIT command too that enable HTTP on Sim module.
But not able to send more long string using 100 ms timerout etx..
I know, this issue of size of byte & timout selection, but is any smarter way to make this automatic selection of size & timeout as it receiver OK in response..
Actually i'm new too STM cube IDE , move from arduino recently .
Thanks !
Serial debug reponse attached as follows !.
