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

Socket offloading implementation for 3rd party AT modem - nrf_socket.c?

Hi,

Instead of an nRF9160, we are trying to expand the functionality of our older nRF52840 board with AT modem on it.

I would like to implement similar support for this modem as that has been implemented for the nRF9160 with on-board modem.
This way, it should be very easy to make use of for example the LwM2M already implemented in Zephyr, instead of having to handle the packets all in the application.

So in summary: I would like to offload networking operations to our own code, in the same way that it is done in the nRF9160.

What is the correct process for this? I could not find the nrf_socket.c file, which I believe is used by the offloading code in nrf_sockets.c.

Parents
  • Hello,

    is there a specific reason for not using the nRF9160? What AT modem are you using? Can you use the nRF9160 modem and communicate with the nRF52840 with the serial LTE modem?

  • Our custom board (designed about 1.5 years ago) does not have an nRF9160 on board, just an nRF52840 + a Quectel BG96. We would like to expand its functionalities.

  • So is it possible for you to use the serial LTE modem then?

  • I have looked at the code. If I replace the AT commands with the ones that the BG96 uses, it should be possible right? 

    But, how do I then make my system use that so that I can do socket() and connect() calls with it?

  • newUser said:
    But, how do I then make my system use that so that I can do socket() and connect() calls with it?

     Does your modem have something similar to these commands? If it does, you could probably use them.

  • Hi Hakon, thank you for your response.

    The modem has similar commands. My struggle now is how to best implement them. Could you elaborate on how the nRF9160 socket offloading driver works? On that system it is possible to use socket() commands, which are then dispatched as AT commands somewhere. But i'm a little lost in all that's going on there.

Reply
  • Hi Hakon, thank you for your response.

    The modem has similar commands. My struggle now is how to best implement them. Could you elaborate on how the nRF9160 socket offloading driver works? On that system it is possible to use socket() commands, which are then dispatched as AT commands somewhere. But i'm a little lost in all that's going on there.

Children
  • newUser said:
    On that system it is possible to use socket() commands, which are then dispatched as AT commands somewhere.

     No, when you call socket(), you call the bsdlib socket API function nrf_socket() by default, unless you have CONFIG_NET_NATIVE=y enabled. The bsdlib communicates with the modem firmware and opens a socket in the modem. You can read more about it here.

  • Exactly, so underwater somewhere there should be a command going to the modem firmware right? I would assume these are AT commands over UART, and I would have to write my own code for this communication. It would be similar to the nRF9160 code, or is that not using AT commands over UART to use the modem IP stack?

  • I have currently used the NET_SOCKET_REGISTER() macro to register a custom socket call with a custom socket method vtable. Now all socket commands are dispatched to my application, in which I forward them as AT commands. See the zephyr/drivers/modem codes.