# FreeRTOS Cellular USART commInterface SAM4LC8

**URL:** <https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173>\
**Category:** Libraries\
**Created:** [November 11, 2022, 9:09am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173 "2022-11-11T09:09:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuli](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Samuli](https://forums.freertos.org/u/Samuli)\
**Post date:** [November 11, 2022, 9:09am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173/1 "2022-11-11T09:09:42Z")

</div>

Hi all!

Im trying to implement FreeRTOS Cellular library to my development board Atmel SAM4L8 xPlained Pro. As a cellular module im using uBlox SARA-R5, which in my understanding goes hand in hand with the FreeRTOS/FreeRTOS-Cellular-Interface-Reference-ublox-SARA-R4 GitHub repository.

Problem: How to implement ATSAM USART with the CellularCommInterface? Has anyone successfully ported Cellular library to Atmel MCU? Every example I can find is on STM32, which are using HAL\_UART functions.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [November 11, 2022, 9:12am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173/2 "2022-11-11T09:12:53Z")

</div>

> [@Samuli](#):
>
> How to implement ATSAM USART with the CellularCommInterface? Has anyone successfully ported Cellular library to Atmel MCU? Every example I can find is on STM32, which are using HAL\_UART functions.

Does Atmel not provide any UART driver for their devices? If yes, you should use that.

---

<div class="post-metadata">

**Author:** ![Samuli](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Samuli](https://forums.freertos.org/u/Samuli)\
**Post date:** [November 11, 2022, 9:29am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173/3 "2022-11-11T09:29:12Z")

</div>

Yes, there are asf drivers, but those drivers do not provide same functionalities that HAL\_UART drivers do, like completecallback for RX and TX.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [November 11, 2022, 9:42am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173/4 "2022-11-11T09:42:17Z")

</div>

> [@Samuli](#):
>
> like completecallback for RX and TX.

Those are callbacks from ISRs for using USART in interrupt driven mode. I took a quick look at [this](https://github.com/avrxml/asf/tree/master/sam/drivers/usart) and it seem that ASF also supports interrupt mode. You can take a look at the examples provided there.

---

<div class="post-metadata">

**Author:** ![Samuli](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Samuli](https://forums.freertos.org/u/Samuli)\
**Post date:** [November 11, 2022, 11:34am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173/5 "2022-11-11T11:34:44Z")

</div>

Okey, my initial question was pretty wide-ranging. Let’s say that asf UART functions DOES work for my intent, but how do I implement those to the communication interface? Has anyone done this before and if is, could someone send me source.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [November 12, 2022, 11:46am UTC](https://forums.freertos.org/t/freertos-cellular-usart-comminterface-sam4lc8/16173/6 "2022-11-12T11:46:33Z")

</div>

> [@Samuli](#):
>
> but how do I implement those to the communication interface?

The [comm interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/source/interface/cellular_comm_interface.h) is a set of functions that you supply to the Cellular library. So what you are asking is how do you write an implementation of comm interface using ASF UART functions. For that you will need to read ASF APIs and figure out how can you implement comm interface functions using those - as an example, the `CellularCommInterfaceSend_t` function sends a data buffer and you should be able to implement it with uart\_tx functions in ASF.
