Hello guys,
Hello @Job.Bao-Q,
How do i publish data after this AT cmd?
Hi Nishikant:
Could you tell me the software version of the module?(excute ATI to check)
What tool did you use for testing?
Usually,after the response >, you can input the data to be sent. Tap CTRL+Z
to send, and tap ESC to cancel the operation.
Thanks @Winnie.Xi-Q for replying.
I am using
Quectel_Ltd
Quectel_M66
Revision: M66FAR02A08BT
I am sending command to module via STM32F03xx controller using UART.
can you tell me the exact sequence of gprs activation at commands ?
1)You can execute at+creg? and at + cgreg? to confirm whether the injection network is successful.
2)If the network is successful,you can do the 3)
3)Here is an example of activating the PDP for your reference
1.AT+QIFGCNT=0
2.AT+QICSGP=1,“cmnet”
3.AT+QIREGAPP
4.AT+QIACT
Thanks for replying.
I am facing some issues implanting the commands.
here is my code.
Blockquote
HAL_Delay(3000);
char rx_buff[20];
if (HAL_UART_Transmit(&huart1,(uint8_t *)"AT\r\n",4,10) == HAL_OK)
{
HAL_UART_Receive(&huart1,(uint8_t *)rx_buff,12,15);
HAL_UART_Transmit(&huart2,(uint8_t *)rx_buff,11,15);
}
HAL_Delay(3000);
/*
HAL_Delay(2000);
HAL_UART_Transmit(&huart1,(uint8_t *)“ATI\r\n”,7,10);
HAL_UART_Receive(&huart1,(uint8_t *)ati_,70,80);
HAL_UART_Transmit(&huart2,(uint8_t *)ati_,70,80);
HAL_UART_Transmit(&huart2,(uint8_t *)“\r\n\r\n”,8,10);
*/
HAL_UART_Transmit(&huart2,(uint8_t *)“\r\n”,2,5);
//---------------------------------------------------------------------------------
HAL_Delay(3000);
char qiop[]="AT+QMTOPEN=?\r\n";
char qiopen[250];
len = strlen(qiop);
if (HAL_UART_Transmit(&huart1,(uint8_t *)qiop,len,20) == HAL_OK)
{
HAL_UART_Receive(&huart1,(uint8_t *)qiopen,58,70);
len = strlen(qiopen);
HAL_UART_Transmit(&huart2,(uint8_t *)qiopen,58,70);
}
HAL_UART_Transmit(&huart2,(uint8_t *)"\r\n",2,5);
//---------------------------------------------------------------------------------
HAL_Delay(3000);
char main_buff[]="AT+QMTOPEN=0,\"xx.xx.17.86\",8883\r\n";
char iopen[250];
len = strlen(main_buff);
if (HAL_UART_Transmit(&huart1,(uint8_t *)"AT+QMTOPEN=0,\"xxx.xx.17.86\",8883\r\n",34,50) == HAL_OK)
{
HAL_UART_Receive(&huart1,(uint8_t *)iopen,100,200);
len = strlen(iopen);
HAL_UART_Transmit(&huart2,(uint8_t *)iopen,100,100);
}
HAL_UART_Transmit(&huart2,(uint8_t *)"\r\n",2,5);
indent preformatted text by 4 spaces
and output on tera term is
AT
+8"
QT+QMTOPEN=?
+QMTOPEN: (0-5),“<host_name>”,
OK
AT+QMTOPEN=0,“xyz.zyx.17.86”,8883
+QMTOPEN: (0-5),“<host_name>”,
OKö5M4ó£?ÿH
where i am doing wrong?
please get me out from this problem.
there are some unwanted character after OK
now i am getting this o/p
AT
OK
+
AT+CREG=1
OK
AT+QMTOPEN=?
+QMTOPEN: (0-5),"<host_name>",
OK
AT+QMTOPEN=0,“139.59.17.86”,8883
OK
+QMTOPEN: 0,2
It means MQTT identifier is occupied.Please use AT+QMTCLOSE=0 to close it and then try to open it again.
How do i add ctrl+Z in my command to pub?
if (HAL_UART_Transmit(&huart1,(uint8_t *)“AT+QMTPUB=0,1,1,0,“GPS_loc”\r\n”,len+2,150) == HAL_OK)
{
HAL_UART_Receive(&huart1,(uint8_t *)mconn,250,700);
len = strlen(mconn);
HAL_UART_Transmit(&huart2,(uint8_t *)mconn,250,500);
}
If you don’t know how to execute Ctrl + Z, you can publish a message at a specified length.
The following is the corresponding instruction description:
`char datapub[50];//="AT+QMTPUB=0,1,1,0,\"GPS_loc\",10"\r\n";
char pub[250];
memset(pub,0,250);
memset(datapub,0,50);
sprintf(datapub,"%s""%s""%s\r\n","AT+QMTPUB=0,1,1,0","\"GPS_loc\"",",10");
len = strlen(datapub);
if (HAL_UART_Transmit(&huart1,(uint8_t *)datapub,len+2,150) == HAL_OK)
{
HAL_UART_Receive(&huart1,(uint8_t *)pub,100,100);
len = strlen(pub);
HAL_UART_Transmit(&huart2,(uint8_t *)pub,100,100);
HAL_UART_Transmit(&huart1,(uint8_t *)"NISHIKANT",9,10);
}`
AT+QMTCLOSE=0
OK
+QMTCLOSE: 0,0
AT+QMTOPEN=0,“139.59.17.86”,8883
OK
+QMTOPEN: 0,0
AT+QMTCONN=0,“GSMsdjhf”,“username”,“password”
OK
+QMTCONN: 0,0,0
AT+QMTPUB=0,1,1,0,“GPS_loc”,10
+CME ERROR: 3518
Is this correct?
You are welcome. Please contact us if you have other questions.