This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GSM Modem Sample Project on nRF 5340 App

Hi. I am trying to get the gsm modem sample project to work with an nRF 5340 app and a Nimbelink LTE modem, NL-SW-LTE-TC4NAG. The only change I made to the project was to add a new file in the boards directory for the 5340. The nrf5340dk_nrf5340_cpuapp.overlay file is below.

The problem is that `uart_dev` is null. The console output I get is below.

I'm not sure if this is a configuration issue or if the modem is not up when `device_get_binding()` is called. What am I missing?

sample_gsm_ppp: Board 'nrf5340dk_nrf5340_cpuapp' APN 'internet' UART 'UART_1' device (nil) (modem_gsm)

&uart0 {
    compatible = "zephyr,gsm-ppp"; // also tried: gsm_ppp,MODEM_GSM_PPP,modem_gsm
    label = "UART_1";
	status = "okay";
	current-speed = <115200>;

	gsm: gsm-modem {
		compatible = "zephyr,gsm-ppp";
		label = "gsm_ppp";
	};
};

Parents
  • code-magic said:
    Thank you so much for the details and links. I will try and test this soon. 

    My pleasure! :-)

    code-magic said:
    Can the modem be run asynchronously? If not, what is the best practice to run the modem on the app core without blocking other processes?

    I’m not familiar with the Nimbelink LTE modem, so not sure if I can provide you with an answer here. But looking at the Software Guideline, I get the impression that everything will be controlled by AT commands via UART. So my first thought would be to use interrupt driven UART, as this will not block the application on the nRF53 and serve incoming data right away.

    Regards,

    Markus

  • I finally got my head wrapped around the different UART interfaces: UART_0: terminal output, UART_1: modem. I setup the pins on UART_1; shown below.

    It doesn't look like the driver knows what to use for the modem. The ppp driver, modem_gsm, and my code all show different pointers for the device.

    .

    Maybe all that I'm lacking is telling the ppp driver what device to use? I thought that was covered with 'compatible="zephyr,gsm-ppp"` in the overlay file.

    &uart0 {
        status = "okay";
    };
    
    &uart1 {
    	status = "okay";
        tx-pin = 3;
    	rx-pin = 8;
    	rts-pin = 2;
    	cts-pin = 7;
    	current-speed = 115200;
    	gsm: gsm-modem {
    		status = "okay";
    		compatible = "zephyr,gsm-ppp";
    		label = "modem_gsm";
    	};
    };

    .

    .

    .

    Below is the output log from the application.

    [00:00:00.400,268] <dbg> net_ppp.ppp_driver_init: [0x20001d88] dev 0x20000214
    [00:00:00.400,360] <dbg> modem_gsm.gsm_init: Generic GSM modem (0x20000730)
    [00:00:00.400,390] <dbg> modem_gsm.gsm_init: iface->read 0x1594f iface->write 0x15985
    [00:00:00.400,421] <dbg> modem_gsm.gsm_rx: starting
    [00:00:00.400,482] <dbg> modem_gsm.gsm_configure: Starting modem 0x20000730 configuration
    [00:00:00.400,695] <dbg> net_mgmt.net_mgmt_event_init: (main): Net MGMT initialized: queue of 2 entries, stack size of 768
    [00:00:00.400,695] <dbg> net_ppp.ppp_iface_init: [0x20001d88] iface 0x20000544
    [00:00:00.400,726] <dbg> net_l2_ppp.net_ppp_init: (main): Initializing PPP L2 0x20001b58 for iface 0x20000544
    [00:00:00.405,303] <dbg> net_mgmt.net_mgmt_add_event_callback: (conn_mgr): Adding event callback 0x200032d8
    [00:00:00.405,303] <dbg> net_mgmt.net_mgmt_add_event_callback: (conn_mgr): Adding event callback 0x200032ec
    [00:00:00.405,334] <dbg> conn_mgr.conn_mgr_handler: (conn_mgr): Connection Manager started
    [00:00:00.405,364] <dbg> net_l2_ppp.tx_handler: (tx_handler_thread): PPP TX started
    
    // everthing above is before main()
    
    [00:00:00.405,364] <inf> mux_cell_wifi: Configured: PIN_MUX_CELL_WIFI_ENABLE
    [00:00:00.405,364] <inf> mux_cell_wifi: Configured: PIN_MUX_CELL_WIFI_SWITCH
    [00:00:00.405,395] <inf> mux_cell_wifi: Select Cell GSM Modem
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_STATUS
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_DTR
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_ON_OFF
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_RESET
    [00:00:00.405,395] <inf> gsm_modem: Turning gsm modem on via 1500ms sleep time.
    [00:00:00.405,426] <inf> gsm_modem: Successfully set gsm_modem On/Off pin 1 = 1. The modem will take approximately 20 seconds to turn on and be ready for AT commands.
    [00:00:01.905,487] <inf> sample_gsm_ppp: Board 'nrf5340dk_nrf5340_cpuapp' APN 'ATT' UART 'UART_1' device 0x200001b4 (modem_gsm)
    [00:00:01.905,487] <dbg> sample_gsm_ppp.init_gsm_modem: GSM Device: 0x2000025c
    [00:00:01.905,517] <dbg> net_mgmt.net_mgmt_add_event_callback: (main): Adding event callback 0x20002550
    [00:00:02.400,726] <dbg> modem_gsm.gsm_configure: modem not ready -116
    [00:00:02.400,756] <dbg> net_l2_ppp.ppp_startup: (sysworkq): PPP 0x20001b58 startup for interface 0x20000544
    [00:00:02.400,756] <dbg> net_l2_ppp.ipcp_init: (sysworkq): proto IPCP (0x8021) fsm 0x20001c70
    [00:00:02.400,787] <dbg> net_l2_ppp.lcp_init: (sysworkq): proto LCP (0xc021) fsm 0x20001ba0
    [00:00:02.400,787] <dbg> modem_gsm.gsm_configure: Starting modem 0x20000730 configuration
    [00:00:04.401,062] <dbg> modem_gsm.gsm_configure: modem not ready -116
    . . . . . . 
    [00:00:04.401,092] <dbg> modem_gsm.gsm_configure: Starting modem 0x20000730 configuration
    [00:00:06.401,336] <dbg> modem_gsm.gsm_configure: modem not ready -116
    . . . . . .

Reply
  • I finally got my head wrapped around the different UART interfaces: UART_0: terminal output, UART_1: modem. I setup the pins on UART_1; shown below.

    It doesn't look like the driver knows what to use for the modem. The ppp driver, modem_gsm, and my code all show different pointers for the device.

    .

    Maybe all that I'm lacking is telling the ppp driver what device to use? I thought that was covered with 'compatible="zephyr,gsm-ppp"` in the overlay file.

    &uart0 {
        status = "okay";
    };
    
    &uart1 {
    	status = "okay";
        tx-pin = 3;
    	rx-pin = 8;
    	rts-pin = 2;
    	cts-pin = 7;
    	current-speed = 115200;
    	gsm: gsm-modem {
    		status = "okay";
    		compatible = "zephyr,gsm-ppp";
    		label = "modem_gsm";
    	};
    };

    .

    .

    .

    Below is the output log from the application.

    [00:00:00.400,268] <dbg> net_ppp.ppp_driver_init: [0x20001d88] dev 0x20000214
    [00:00:00.400,360] <dbg> modem_gsm.gsm_init: Generic GSM modem (0x20000730)
    [00:00:00.400,390] <dbg> modem_gsm.gsm_init: iface->read 0x1594f iface->write 0x15985
    [00:00:00.400,421] <dbg> modem_gsm.gsm_rx: starting
    [00:00:00.400,482] <dbg> modem_gsm.gsm_configure: Starting modem 0x20000730 configuration
    [00:00:00.400,695] <dbg> net_mgmt.net_mgmt_event_init: (main): Net MGMT initialized: queue of 2 entries, stack size of 768
    [00:00:00.400,695] <dbg> net_ppp.ppp_iface_init: [0x20001d88] iface 0x20000544
    [00:00:00.400,726] <dbg> net_l2_ppp.net_ppp_init: (main): Initializing PPP L2 0x20001b58 for iface 0x20000544
    [00:00:00.405,303] <dbg> net_mgmt.net_mgmt_add_event_callback: (conn_mgr): Adding event callback 0x200032d8
    [00:00:00.405,303] <dbg> net_mgmt.net_mgmt_add_event_callback: (conn_mgr): Adding event callback 0x200032ec
    [00:00:00.405,334] <dbg> conn_mgr.conn_mgr_handler: (conn_mgr): Connection Manager started
    [00:00:00.405,364] <dbg> net_l2_ppp.tx_handler: (tx_handler_thread): PPP TX started
    
    // everthing above is before main()
    
    [00:00:00.405,364] <inf> mux_cell_wifi: Configured: PIN_MUX_CELL_WIFI_ENABLE
    [00:00:00.405,364] <inf> mux_cell_wifi: Configured: PIN_MUX_CELL_WIFI_SWITCH
    [00:00:00.405,395] <inf> mux_cell_wifi: Select Cell GSM Modem
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_STATUS
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_DTR
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_ON_OFF
    [00:00:00.405,395] <inf> gsm_modem: Configured: PIN_GSM_MODEM_RESET
    [00:00:00.405,395] <inf> gsm_modem: Turning gsm modem on via 1500ms sleep time.
    [00:00:00.405,426] <inf> gsm_modem: Successfully set gsm_modem On/Off pin 1 = 1. The modem will take approximately 20 seconds to turn on and be ready for AT commands.
    [00:00:01.905,487] <inf> sample_gsm_ppp: Board 'nrf5340dk_nrf5340_cpuapp' APN 'ATT' UART 'UART_1' device 0x200001b4 (modem_gsm)
    [00:00:01.905,487] <dbg> sample_gsm_ppp.init_gsm_modem: GSM Device: 0x2000025c
    [00:00:01.905,517] <dbg> net_mgmt.net_mgmt_add_event_callback: (main): Adding event callback 0x20002550
    [00:00:02.400,726] <dbg> modem_gsm.gsm_configure: modem not ready -116
    [00:00:02.400,756] <dbg> net_l2_ppp.ppp_startup: (sysworkq): PPP 0x20001b58 startup for interface 0x20000544
    [00:00:02.400,756] <dbg> net_l2_ppp.ipcp_init: (sysworkq): proto IPCP (0x8021) fsm 0x20001c70
    [00:00:02.400,787] <dbg> net_l2_ppp.lcp_init: (sysworkq): proto LCP (0xc021) fsm 0x20001ba0
    [00:00:02.400,787] <dbg> modem_gsm.gsm_configure: Starting modem 0x20000730 configuration
    [00:00:04.401,062] <dbg> modem_gsm.gsm_configure: modem not ready -116
    . . . . . . 
    [00:00:04.401,092] <dbg> modem_gsm.gsm_configure: Starting modem 0x20000730 configuration
    [00:00:06.401,336] <dbg> modem_gsm.gsm_configure: modem not ready -116
    . . . . . .

Children
No Data
Related