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";
	};
};

  • I've made some progress. I created the project in Segger and moved my nrf5340dk_nrf5340_cpuapp.overlay file to the project. I changed the UART label to UART_1. I see that device_get_binding() is now returning a valid device for both uart_dev & gsm_dev. The event_handler() is never called so I guess the modem never connects. Is there a way for me to see what's going on behind the scenes deeper than the debug point never being hit?

    I'm confused now because this project accepts UART commands and the modem is also on UART. When I enter a command (resume/suspend) with putty connected to COM4 of the device I get a 'command not found' error. I'm afraid that uart_dev and gsm_dev is the same device according to the overlay file.

    Is my overlay file correct? There is a power light on the modem so I know it's on, the event_handler() just isn't being called.

  • Hello Justin,

    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?

    First of all, you might not want to change the compatible of the UART since that will make the peripheral non-functional.

    The sample uses UART_1, which is disabled for nrf5340_cpuapp by default.

    uart1: arduino_serial: uart@9000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0x9000 0x1000 >;
    				interrupts = < 0x9 0x1 >;
    				status = "disabled";
    				label = "UART_1";
    				current-speed = < 0x1c200 >;
    				tx-pin = < 0x21 >;
    				rx-pin = < 0x20 >;
    			};

    To enable it, you have to enable the periperhal in your overlay file:

    &uart1 {
        status = "okay";
    };

    With this change, the samples provides the following output on my nRF5340 DK, which looks correct to me:

    Velkommen til minicom 2.8
    
    MULIGHETER: I18n 
    Port /dev/ttyACM2, 16:10:55
    
    Trykk CTRL-A Z for hjelp om spesialtaster
    
    *** Booting Zephyr OS build v2.6.99-ncs1  ***
    
    
    [00:00:00.434,051] <inf> sample_gsm_ppp: Board 'nrf5340dk_nrf5340_cpuapp' APN 'internet' UART 'UART_1' device 0x1631c (modem_gsm)
    uart:~$ 

    I hope this will help you.

    Regards,

    Markus

  • Thank you, this helps some. I have new found information if you can help me out with this. The modem will be ran from the net core on non standard pins for TX, RX, RTS, & CTS. Given this, do I need to only need to set the pins in my overlay file for UART 0. Or will setting this for UART1 on net core be ok?

    Custom Pins:

    • TX: P 0.03
    • RX: P0.08
    • RTS: P0.02
    • CTS: P0.07

    The default config for UART 0 is below, nrf5340dk_nrf5340_cpunet.dts. Note, I'm not sure how to get the `<` & `>` in the code below. 

    Is this correct for the pin number for TX: `tx-pin = <3>;`?

    From Zephyr:

    &uart0 {
    	status = "okay";
    	current-speed = <  115200  >;
    	tx-pin = <33>;
    	rx-pin = <32>;
    	rx-pull-up;
    	rts-pin = <11>;
    	cts-pin = <10>;
    	cts-pull-up;
    };

    Custom Overlay:

    &uart0 {
    	status = "okay";
    	tx-pin = 3;
    	rx-pin = 8;
    	rts-pin = 2;
    	cts-pin = 7;
    };

  • Hello,

    code-magic said:
    Is this correct for the pin number for TX: `tx-pin = <3>;`?

    In your case, the .overlay should look like this:

    &uart0 {
        status = "okay";
        tx-pin = <3>;
    	rx-pin = <8>;
    	rts-pin = <2>;
    	cts-pin = <7>;
    };

    code-magic said:
    The modem will be ran from the net core on non standard pins for TX, RX, RTS, & CTS. Given this, do I need to only need to set the pins in my overlay file for UART 0. Or will setting this for UART1 on net core be ok?

    Please be aware that the app core has to give the net core permission for each pin it wants to use, as illustrated in the nRF5340: Empty firmware for application core sample. I’m not quite sure how sufficient it will work having the GSM modem connected to the net core, as it in general is not designed for this kind of usage. So my recommendation would be to use the app core instead.

    Regards,

    Markus

  • Thank you so much for the details and links. I will try and test this soon. 

    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?

    A problem we've ran in with other boards is that the network transaction blocks a more important process.

Related