nrf91/nrf91_modem.c: configure system mode
This commit is contained in:
parent
c53211afb9
commit
d38bf3ff2d
@ -742,4 +742,31 @@ config NRF91_MODEM_AT
|
||||
bool "Modem AT interface support"
|
||||
default y
|
||||
|
||||
config NRF91_MODEM_LTEM
|
||||
bool "Modem LTE-M mode support"
|
||||
default y
|
||||
|
||||
config NRF91_MODEM_NBIOT
|
||||
bool "Modem NB-IoT mode support"
|
||||
default n
|
||||
|
||||
config NRF91_MODEM_GNSS
|
||||
bool "Modem GNSS support"
|
||||
depends on SENSORS_GPS
|
||||
default y
|
||||
|
||||
config NRF91_MODEM_PREFERENCE
|
||||
int "Modem mode preference"
|
||||
default 0
|
||||
range 0 4
|
||||
---help---
|
||||
0 - No preference. Initial system selection is based on history data and USIM
|
||||
1 - LTE-M preferred
|
||||
2 - NB-IoT preferred
|
||||
3 - Network selection priorities override system priority, but LTE-M is prefered
|
||||
4 - Network selection priorities override system priority, but NB-IoT is prefered
|
||||
|
||||
For details look at "nRF9160 AT Commands Command Reference Guid" from Nordic,
|
||||
section "5.27 System mode"
|
||||
|
||||
endif # NRF91_MODEM
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "chip.h"
|
||||
|
||||
#include "nrf_modem.h"
|
||||
#include "nrf_modem_at.h"
|
||||
|
||||
#include "nrf91_modem.h"
|
||||
|
||||
@ -47,6 +48,18 @@
|
||||
# error NRF91 modem requires using LFXO as the LFCLK source
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NRF91_MODEM_LTEM
|
||||
# define CONFIG_NRF91_MODEM_LTEM 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NRF91_MODEM_NBIOT
|
||||
# define CONFIG_NRF91_MODEM_NBIOT 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NRF91_MODEM_GNSS
|
||||
# define CONFIG_NRF91_MODEM_GNSS 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
@ -102,6 +115,30 @@ static void nrf91_modem_fault_handler(struct nrf_modem_fault_info *info)
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf91_modem_config
|
||||
****************************************************************************/
|
||||
|
||||
static int nrf91_modem_config(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Configure modem system mode */
|
||||
|
||||
ret = nrf_modem_at_printf("AT%%XSYSTEMMODE=%d,%d,%d,%d",
|
||||
CONFIG_NRF91_MODEM_LTEM,
|
||||
CONFIG_NRF91_MODEM_NBIOT,
|
||||
CONFIG_NRF91_MODEM_GNSS,
|
||||
CONFIG_NRF91_MODEM_PREFERENCE);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto errout;
|
||||
}
|
||||
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -125,6 +162,15 @@ int nrf91_modem_initialize(void)
|
||||
|
||||
/* Initial modem configuration */
|
||||
|
||||
ret = nrf91_modem_config();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("nrf91_modem_config failed %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Initial modem configuration */
|
||||
|
||||
ret = nrf91_modem_config();
|
||||
if (ret < 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user