This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connect nRF52832 to CoAP IP using an LTE module.

Good morning,

I am using SDK 16.0.0 and nRF52832 uC. I have a project where I need to connect the uC to a CoAP IP. The only internet access it has is through an SoC developed by U-BLOX called SARA-R410M-02B which has an LTE unit embedded in our board. Is there a possibility to use CoAP supported libraries in this SDK and configure it to use it with our modem?

Thanks in advance.

Parents Reply Children
  • One more thing, even though I am able to build a CoAP client project using the Zephyr platform, yet when I debug it on my boards, none of them works as expected at all. Any suggestion..

  • I think my initial advice was a bit misleading. 

    The Zephyr CoAP library will only format and parse the data, it does not have the functionality to send and receive it. Hence the CoAP client sample assumes the platform running it has networking support, so if you're running the sample on an nRF52 board, it will not be able to receive data.

    This is where the CoAP utils library in NCS comes in. It combines the Zephyr CoAP library to format data with the BSD Sockets API to send and receive.

    This library will work on an nRF52 device as long as there is some external device that implements BSD sockets: in your case the U-Blox modem. 

    You can try this with the nRF CoAP Client sample available in NCS, which uses the CoAP utils library. You will need to add an overlay file (<board_name.overlay>) to add the U-Blox modem to the device tree. Something like this:

    &uart0 {
    	current-speed = <115200>;
    	status = "okay";
    
    	sara_r4 {
    		compatible = "ublox,sara-r4";
    		label = "ublox-sara-r4";
    		mdm-power-gpios = <&arduino_header 11 0>; /* D5 */
    		mdm-reset-gpios = <&arduino_header 12 0>; /* D6 */
    		status = "okay";
    	};
    };
    

    Then in the prj.conf file, add and remove the following configs.

    # Add these
    CONFIG_NRFX_UART0=y
    CONFIG_MODEM=y
    CONFIG_MODEM_UBLOX_SARA=y
    CONFIG_MODEM_UBLOX_SARA_R4=y
    
    # Remove these
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
    CONFIG_NRF_MODEM_LIB=y
    CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=n
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_AT_HOST_LIBRARY=y

    I don't have a U-Blox modem to actually test this, so you might have to make some more modifications. But let me know how testing this goes!

    Best regards,

    Heidi

  • By building up your suggested project on my board and adding your modifications, I get these errors in devicetree.h definition: #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat)):

    1. 'DT_N_INST_0_ublox_sara_r4_P_mdm_power_gpios_IDX_0_PH_P_label' undeclared here (not in a function)
    2. 'DT_N_INST_0_ublox_sara_r4_P_mdm_power_gpios_IDX_0_VAL_pin' undeclared here (not in a function)
    3. 'DT_N_INST_0_ublox_sara_r4_BUS_P_hw_flow_control' undeclared (first use in this function)
    4. 'DT_N_INST_0_ublox_sara_r4_BUS_P_label' undeclared (first use in this function) 

    Regards!

  • Can you check the resulting DeviceTree (the build/zephyr/zephyr.dts file) to see if the uart0 node was modified?

    Which NCS version are you using?

Related