Accessing cellular modem via nrf52840dk

Hi, I am using nrf52840dk along with Quectel BG95 module with the sample "cellular modem"

Can i able to use the bg95 driver for nrf52840??

When i tried to build it for the nrf52840dk, i got the following kconfig warnings

-- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: C:/ncs/v2.5.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Found devicetree overlay: c:/Users/Public/vs_projects/cellular_modem/nrf52840dk_nrf52840.overlay
-- Generated zephyr.dts: C:/Users/Public/vs_projects/cellular_modem/build_1/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/Public/vs_projects/cellular_modem/build_1/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/Public/vs_projects/cellular_modem/build_1/zephyr/dts.cmake
Parsing C:/ncs/v2.5.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.5.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration 'c:/Users/Public/vs_projects/cellular_modem/prj.conf'

warning: Experimental symbol NET_L2_PPP is enabled.


warning: Experimental symbol NET_CONNECTION_MANAGER is enabled.


warning: MODEM_BACKEND_UART (defined at subsys/modem\backends/Kconfig:9) has direct dependencies (UART_INTERRUPT_DRIVEN || UART_ASYNC_API) && MODEM_MODULES with value n, but is currently being y-selected by the following symbols:
 - MODEM_CELLULAR (defined at drivers/modem/Kconfig.cellular:4), with value y, direct dependencies (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || DT_HAS_SWIR_HL7800_ENABLED) && MODEM (value: y), and select condition (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || DT_HAS_SWIR_HL7800_ENABLED) && MODEM (value: y)

error: Aborting due to Kconfig warnings

CMake Error at C:/ncs/v2.5.0/zephyr/cmake/modules/kconfig.cmake:348 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:/ncs/v2.5.0/nrf/cmake/modules/kconfig.cmake:29 (include)
  C:/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:5 (find_package)

but i have set the status to okay for the bg95 module in the overlay file, is there anything im missing??

/* BG95 */
&uart1 {
	pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
	pinctrl-names = "default", "sleep";
	current-speed = <115200>;
	hw-flow-control;

	// dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX
	// 	&gpdma1 1 26 STM32_DMA_PERIPH_RX>;
	// dma-names = "tx", "rx";

	status = "okay";

	modem: modem {
		compatible = "quectel,bg95";
		mdm-power-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};
};

also the configs

CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y

have been set by default in build.

my prj.conf for ref.

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_IPV4=y
CONFIG_NET_UDP=y
CONFIG_NET_SOCKETS=y

# DNS
CONFIG_DNS_RESOLVER=y
CONFIG_NET_L2_PPP_OPTION_DNS_USE=y

# Network management
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_CONNECTION_MANAGER=y

# Modem driver
CONFIG_MODEM=y
CONFIG_PM_DEVICE=y
CONFIG_MODEM_CELLULAR=y

Parents
  • Hello, 

    Looking at the Cellular modem sample, it configures the dts differently from yours. Did you follow the same steps as it does?

    /dts-v1/;
    
    / {
            aliases {
                    modem = &modem;
            };
    };
    
    &usart2 {
            pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>;
            pinctrl-names = "default";
            current-speed = <115200>;
            hw-flow-control;
            status = "okay";
    
            modem: modem {
                    compatible = "quectel,bg9x";
                    mdm-power-gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
                    mdm-reset-gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
                    status = "okay";
            };
    };
    

    Also, the GSM Modem sample (zephyr/samples/net/gsm_modem/) configures the BG95 in the following way:

    /* BG95 */
    &usart2 {
    	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>;
    	pinctrl-names = "default";
    	current-speed = <115200>;
    	hw-flow-control;
    
    	dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX
    		&gpdma1 1 26 STM32_DMA_PERIPH_RX>;
    	dma-names = "tx", "rx";
    
    	status = "okay";
    
    	modem: modem {
    		compatible = "zephyr,gsm-ppp";
    		status = "okay";
    	};
    };

    Did you add the dts to nrf52840dk_nrf52840.overlay?

    Kind regards,
    Øyvind

  • Hey, thanks !

    i just got confused between bg9x and cellular_modem driver

    now i have changed my project towards the bg9x driver files,

    im able to build the project with my module inside uart node, and all the setup commands in the driver got executed fine,

    now, how can i able to access the driver api functions, like sending a tcp??

    i see all the functions are in the "socket_op_vtable" struct, and that is being configured as modem socket.

    is there any guide to look out for to get to know about accessing these sockets??

    Kindly guide me through this.

Reply
  • Hey, thanks !

    i just got confused between bg9x and cellular_modem driver

    now i have changed my project towards the bg9x driver files,

    im able to build the project with my module inside uart node, and all the setup commands in the driver got executed fine,

    now, how can i able to access the driver api functions, like sending a tcp??

    i see all the functions are in the "socket_op_vtable" struct, and that is being configured as modem socket.

    is there any guide to look out for to get to know about accessing these sockets??

    Kindly guide me through this.

Children
Related