sudhir
March 20, 2021, 1:30pm
1
hello sir,
i am communication between mcu to quctel m66 with using UART Communication .when i an sending AT cmd to gsm module and gsm responding data + carriage return i.e-
[TX]- AT
[RX]- OK
How to remove carriage return & which cmd are use for that.
thank you,
Kyson
March 22, 2021, 8:43am
2
Dear Sudhir,
Thanks for your inquiry in Quectel forum.
Sorry that cannot remove the carriage return. Thanks!
sudhir
March 23, 2021, 11:27am
3
Hello kyson,
I am trying to communicate MCU to Quectel M66 using UART. I
send AT cmd to M66 module.
Response format: + data + i.e-
[TX]- { [AT]<CR }
[RX]- { [<CR<LF OK <CR<LF] }
I am getting carriage return before and after data. I want to read the <carriage Return><Line Feed> at end of data.
The problem is, I am not able to read this. Please suggest me how to read after data.
My Code snippet:
int main ( void )
{
char messageStart[] = “AT\r\n”;
char receiveBuffer[50] = {};
char data = 0;
char check[2]={‘O’,‘K’};
uint16_t rxCounter=0;
while ( true )
{
SERCOM5_USART_Write(&messageStart[0], sizeof(messageStart)); // tx data
if(SERCOM5_USART_ReceiverIsReady() == true)
{
SERCOM5_USART_Read(&data, 1); //rx data
receiveBuffer[rxCounter++] = data;
if((data == '\n') || (data == '\r') || (data == '\0')) // I want to check CR and LF here. But, its not working
{
SERCOM2_USART_Write(&receiveBuffer[0],rxCounter);
for(i=0;i<=rxCounter;i++)
{
if( receiveBuffer[i] == check[0]) // check o char
{
if( receiveBuffer[i+1] == check[1]) // check k char
{
printf ("toggle on/off \n");
LED_1_Toggle();
memset(&receiveBuffer, 0, sizeof(receiveBuffer));
rxCounter = 0;
}
}
}
}
}
}
//…
}
Kindly, guide me and let me know, where I am doing wrong? Is it my code issue or something from Quectel.
thank you,
Sudhir Khairnar