I am using an nrf9160DK with modem firmware v1.3.2.
I want to be able to send the "AT#" type of SLM-specific AT commands to the modem (and read the response back) via firmware on the nRF9160.
In the lte_serial_mode example, I use the nrf_modem_at_cmd() function. Using the AT commands (AT+ and AT%) does not generate any errors while with the "SLM specific AT commands" (AT#) it generates an error.
CODE:
err = nrf_modem_at_cmd(buf_rx, 500, "AT%%XTEMPHIGHLVL?");
for (int i = 0; i < 20; i++)
{
printk("%c",buf_rx[i]);
buf_rx[i] = 0;
}
printk("%c\n",buf_rx[20]);
buf_rx[20] = 0;
if (err == (0)) {
/* OK, success */
printk("OK, success\n");
}
else if (err < 0) {
/* Failed to send command, err is an nrf_errno */
printk("error < 0\n");
}
else if (err > 0) {
/* Command was sent, but response is not "OK" */
gpio_pin_toggle(ledINT, PINLEDINT);
printk("error > 0\n");
switch(nrf_modem_at_err_type(err)) {
case NRF_MODEM_AT_ERROR:
/* Modem returned "ERROR" */
printk("error\n");
break;
case NRF_MODEM_AT_CME_ERROR:
/* Modem returned "+CME ERROR" */
printk("cme error: %d\n", nrf_modem_at_err(err));
break;
case NRF_MODEM_AT_CMS_ERROR:
/* Modem returned "+CMS ERROR" */
printk("cms error: %d\n", nrf_modem_at_err(err));
break;
}
}
err = nrf_modem_at_cmd(buf_rx, 500, "AT#XHTTPCCON?");
for (int i = 0; i < 20; i++)
{
printk("%c",buf_rx[i]);
buf_rx[i] = 0;
}
printk("%c\n",buf_rx[20]);
buf_rx[20] = 0;
if (err == (0)) {
/* OK, success */
printk("OK, success\n");
}
else if (err < 0) {
/* Failed to send command, err is an nrf_errno */
printk("error < 0\n");
}
else if (err > 0) {
/* Command was sent, but response is not "OK" */
printk("error > 0\n");
switch(nrf_modem_at_err_type(err)) {
case NRF_MODEM_AT_ERROR:
/* Modem returned "ERROR" */
printk("error\n");
break;
case NRF_MODEM_AT_CME_ERROR:
/* Modem returned "+CME ERROR" */
printk("cme error: %d\n", nrf_modem_at_err(err));
break;
case NRF_MODEM_AT_CMS_ERROR:
/* Modem returned "+CMS ERROR" */
printk("cms error: %d\n", nrf_modem_at_err(err));
break;
}
}
LTE LINK MONITOR RESPONCE
If the "SLM-specific AT commands" are sent from the terminal of the nRF Connect LTE Link Monitor tool, they work correctly.
Could someone help me?
Thanks