Porting the FreeRTOS-Plus-TCP library to MCU nRF52840dk "nRF52840 + bg96"

Hello ,

I am working on a project an nRF52840DK + quectel BG96 modem. I am porting the freeRTOS cellular interface library for the Nordic platform and mainly the FreeRTOS-Plus-TCP library.

I would like to know if anyone has managed to port the FreeRTOS-Plus-TCP library to MCU nordic ( nRF5280 DK) especially the MAC Ethernet driver part, otherwise I tried to look for an ethernet driver for initialization of the ethernet MAC layer.

can you help me on how to port the freeRTOS-plus-tcp port to nRF52840DK,
I was following this support Porting TCP/IP Ethernet drivers to a different MCU, but I don’t know where I could find the ethernet drivers for nRF52840 to create a link with the network, it’s too vague for me.

Thank you and best regards,

Can you provide some additional information. I have looked up the nRF52840 DK and the nRF52840. This MCU does not have an ethernet MAC onboard.

If you are trying to use the BG96 with the nRF52840, I recommend the FreeRTOS Cellular Interface repo here: GitHub - FreeRTOS/FreeRTOS-Cellular-Interface: FreeRTOS Cellular Interface implementation of the 3GPP TS v27.007 standard.
Specifically it includes support for the BG96 here: GitHub - FreeRTOS/FreeRTOS-Cellular-Interface-Reference-Quectel-BG96

Hi jjulich,

Thank you for your feedback.

Exactly, at first I started with a demo using ( FreeRTOS, FreeRTOS-Plus-TCP and FreeRTOS-Cellular-Interface on PC and tested it and it worked ) fine on PC, link below:


Then I wanted to integrate the project on a microcontroller and port the library to our Nordic nRF52840dk platform.

I did the porting and integrate the Cellular Interface Library with MCU platforms part for the hardware (USART driver) using support porting guide and afterwards I noticed that the project also uses the freertos-tcp library to manage the AT commands and that’s why I noticed that it is also necessary to port for our nRF52840DK MCU, usually I need a file
networkInterface for our microcontroller.

That’s what I understood, am I right?

Thank you .

Best Regards,

Hi @ATYQ_1991,
Actually, BG96 handles TCP-IP stack internally, so it’s not necessary to port networkInterface/FreeRTOS-Plus-TCP. But you need to provide an interface for your application to use, you can refer to socket_wrapper and using_mbedtls.
Of course, you need to initialize BG96 properly at runtime, like setupCellular.


1 Like

Hi ActoryOu,

Thank you for your feedback .

Sorry, I Don’t understand what you mean.

Do you have an example or a demo please?

Best regards,


In summary, you don’t need FreeRTOS-Plus-TCP to send/receive data to/from BG96.

You can take the same demo as reference. Try to know how does the data transmit from application to server. That would be helpful for you.


Hi ActoryOu,

I looked at the communication part between the modem and the server and I see that the library uses the MQTT protocol with MbedTLS mutual authentication with an mqtt broker using cellular connectivity so in general it uses the TCP + MbedTLS .

For information I’m still on the windows version and it works well with BG96, and I got this project.

For information I use the nRF52840 kit and do not have an Ethernet port, I just have to interface the evaluation kit with modem via USART.

Is there a guide that can show the steps to port this project to an MCU like nRF52?

on the FreeRTOSConfig.h file in the project, I found remarks on macros but I didn’t really understand especially when I look for these macros in the project, I see that they are not used in the project, can you please enlighten me?

Thanks for your help.


As I mentioned, BG96 handles TCP/IP stacks inside itself, so you don’t need to have it in your platform. You can try to trace the data flow starting from TLS_FreeRTOS_send. It doesn’t use FreeRTOS-Plus-TCP, it uses Sockets_Send in sockets_wrapper.c, which uses Cellular_SocketSend(FreeRTOS-Cellular-Interface) NOT FreeRTOS_send(FreeRTOS-Plus-TCP).

From current information, I suggest you to:

  1. Follow Creating a New FreeRTOS Port to create a port based on nRF52840DK MCU SDK.
  2. Follow porting guide to create connections between nRF52840DK and BG96 through USART in FreeRTOS.
  3. Build your transport layer, such as Cellular Sockets Wrapper.
  4. Build your TLS layer, such as using_mbedtls, if you need TLS.
  5. Build your application to use your transport/TLS layer and run it.


1 Like

Hi ActoryOu,

Thank you for your help.

Best Regards