lte/alt1250: Force change modem parameter

In some conditions, LTE connection has issue.
To fix it, need to change a modem parameter.
This commit is contained in:
SPRESENSE 2024-01-25 11:40:29 +09:00 committed by Alin Jerpelea
parent 9fd1251dcb
commit 90c9364b3b
3 changed files with 73 additions and 0 deletions

View File

@ -431,6 +431,33 @@ int ltenwop_send_setnwoptp(FAR struct alt1250_s *dev,
return send_internal_at_command(dev, container, -1, NULL, 0, &dummy);
}
/****************************************************************************
* name: ltesp_send_getscanplan
****************************************************************************/
int ltesp_send_getscanplan(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container)
{
int32_t dummy;
snprintf((FAR char *)dev->tx_buff, _TX_BUFF_SIZE,
"AT%%GETCFG=\"SCAN_PLAN_EN\"\r");
return send_internal_at_command(dev, container, -1, NULL, 0, &dummy);
}
/****************************************************************************
* name: ltesp_send_setscanplan
****************************************************************************/
int ltesp_send_setscanplan(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container,
bool enable)
{
int32_t dummy;
snprintf((FAR char *)dev->tx_buff, _TX_BUFF_SIZE,
"AT%%SETCFG=\"SCAN_PLAN_EN\",\"%s\"\r", (enable ? "1" : "0"));
return send_internal_at_command(dev, container, -1, NULL, 0, &dummy);
}
/****************************************************************************
* name: lwm2mstub_send_getqueuemode
****************************************************************************/

View File

@ -109,6 +109,13 @@ int ltenwop_send_getnwop(FAR struct alt1250_s *dev,
int ltenwop_send_setnwoptp(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container);
int ltesp_send_getscanplan(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container);
int ltesp_send_setscanplan(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container,
bool enable);
int lwm2mstub_send_getqueuemode(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container,
int16_t usockid, FAR int32_t *ures);

View File

@ -192,6 +192,37 @@ static int recv_atreply_onreset(atreply_parser_t parse,
return ret;
}
/****************************************************************************
* name: alt1250_disable_scanplan
****************************************************************************/
static int alt1250_disable_scanplan(FAR struct alt1250_s *dev,
FAR struct alt_container_s *container)
{
int recv_ret;
struct atreply_truefalse_s t_or_f;
t_or_f.target_str = "0";
ltesp_send_getscanplan(dev, container);
recv_ret = recv_atreply_onreset(check_atreply_truefalse, dev, &t_or_f);
if (recv_ret == REP_MODEM_RESET)
{
return recv_ret;
}
if (!t_or_f.result)
{
ltesp_send_setscanplan(dev, container, false);
recv_ret = recv_atreply_onreset(check_atreply_ok, dev, NULL);
if (recv_ret == REP_MODEM_RESET)
{
return recv_ret;
}
}
return recv_ret;
}
/****************************************************************************
* name: alt1250_lwm2m_ponreset
****************************************************************************/
@ -319,6 +350,14 @@ static int alt1250_lwm2m_ponreset(FAR struct alt1250_s *dev,
ret = REP_SEND_ACK;
}
/* Make sure SCAN_PALAN_EN is 0 */
recv_ret = alt1250_disable_scanplan(dev, container);
if (recv_ret == REP_MODEM_RESET)
{
return recv_ret;
}
if (ret == REP_SEND_ACK)
{
/* Force Reset is needed. */