Topics

SODAQ One V3 porting

Léonard Bise <leodido99@...>
 

Hello guys,

I'm going to work on a project which is going to use the SODAQ One board (https://shop.sodaq.com/en/sodaq-one-eu-rn2483-v3.html).

It's a LoRa oriented development board which is designed around a ATSAMD21G18 (ARM Cortex M0+) microcontroller. In addition it has a uBlox EVA 8M GPS Module, LSM303AGR accelerometer and a LoRa + LoRaWAN RN2483A chip from Microchip.

The RN2483A LoRa chip uses a serial line, I won't be using a LoRaWAN stack, which I understand is not yet implemented in Zephyr anyway, so I guess there is no major issues there. The chip is commanded through simple commands.
The uBlox EVA 8M GPS module is connected to the I2C bus.
The LSM303AGR accelerometer is connected to the I2C bus.

In the supported hardware I see that the Adafruit Feather M0 Basic Prot is listed, which has this exact same microcontroller. I also read the Board Porting Guide and as I understand it basically I'd need to take the Adafruit configuration as a base and add these new components to the kconfiguration. All of the aspects related to the microcontroller are already there.

I was wondering how easy it would be to port Zephyr to the SODAQ One and if anyone has comments, advices and maybe point out if I'm missing something. 
In particular I'm also wondering how to handle the LoRa microchip, since Zephyr has no LoRaWAN stack what would be the best way to handle the porting of this part?

I'm really looking forward to work with Zephyr, which I have never used, but I have various experiences with other RTOSes.

Thank you,
Léonard.

Henrik Brix Andersen
 

Hi Léonard

On 18 May 2018, at 11.56, Léonard Bise <leodido99@...> wrote:
I'm going to work on a project which is going to use the SODAQ One board (https://shop.sodaq.com/en/sodaq-one-eu-rn2483-v3.html).
Sweet.

In the supported hardware I see that the Adafruit Feather M0 Basic Prot is listed, which has this exact same microcontroller. I also read the Board Porting Guide and as I understand it basically I'd need to take the Adafruit configuration as a base and add these new components to the kconfiguration. All of the aspects related to the microcontroller are already there.
I did the port to the Adafruit Feather M0 Basic Proto. Let me know if I can help with the port for the SODAQ board.

In particular I'm also wondering how to handle the LoRa microchip, since Zephyr has no LoRaWAN stack what would be the best way to handle the porting of this part?
Perhaps a simple solution could be to just add a sample application using the LoRaWAN chip over UART from the application layer?

Best regards,
Brix
--
Henrik Brix Andersen

Léonard Bise <leodido99@...>
 

I'm back again!
I think I sent the last mail only to Brix by mistake.

I'm happy to say that I fixed my issue... 

I needed to set my pin mux function as D not C.

#if CONFIG_UART_SAM0_SERCOM5_BASE_ADDRESS
/* SERCOM5 on RX=PB3/pad 1, TX=PB2/pad 0 */
pinmux_pin_set(muxb, 2, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 3, PINMUX_FUNC_D);
#endif

***** Booting Zephyr OS v1.12.0-333-g2c8c1310f *****                            
Hello World! arm

Now I'm going to try to communicate with the RN2483 chip through an UART device

Best regards,
Léonard.


On 1 June 2018 at 19:03, Henrik Brix Andersen <henrik@...> wrote:
Hi Léonard

> On 18 May 2018, at 11.56, Léonard Bise <leodido99@...> wrote:
> I'm going to work on a project which is going to use the SODAQ One board (https://shop.sodaq.com/en/sodaq-one-eu-rn2483-v3.html).

Sweet.

> In the supported hardware I see that the Adafruit Feather M0 Basic Prot is listed, which has this exact same microcontroller. I also read the Board Porting Guide and as I understand it basically I'd need to take the Adafruit configuration as a base and add these new components to the kconfiguration. All of the aspects related to the microcontroller are already there.

I did the port to the Adafruit Feather M0 Basic Proto. Let me know if I can help with the port for the SODAQ board.

> In particular I'm also wondering how to handle the LoRa microchip, since Zephyr has no LoRaWAN stack what would be the best way to handle the porting of this part?

Perhaps a simple solution could be to just add a sample application using the LoRaWAN chip over UART from the application layer?

Best regards,
Brix
-- 
Henrik Brix Andersen



Léonard Bise <leodido99@...>
 

I'm having difficulties trying to communicate with the LoRa UART interface.

I set it up like so:

pinmux.c

#if CONFIG_UART_SAM0_SERCOM2_BASE_ADDRESS
/* SERCOM2 LoRa UART on RX=PA13/pad 1, TX=PA12/pad 0 */
pinmux_pin_set(muxa, 12, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 13, PINMUX_FUNC_C);
#endif

board.h

/* SERCOM2 LoRa UART on RX=PA13/pad 1, TX=PA12/pad 0 */
#define CONFIG_UART_SAM0_SERCOM2_PADS \
(SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(0))

sodaq_one_v3.dts

&sercom2 {
status = "ok";
compatible = "atmel,sam0-uart";
current-speed = <57600>;
};

I created a test program similar to samples/subsys/usb/cdc_arm
In my test program I get the device like so.

lora = device_get_binding(ATMEL_SAM0_UART_42001000_LABEL);

I didn't find any documentation on how to determine the device names and I'm not sure it's the correct one, could someone enlighten me?

However as soon as I enable the RX or TX IRQ I'm stuck in an interruption loop so I guess something must be off with my configuration.

Best regards,
Léonard.



On 1 June 2018 at 19:03, Henrik Brix Andersen <henrik@...> wrote:
Hi Léonard

> On 18 May 2018, at 11.56, Léonard Bise <leodido99@...> wrote:
> I'm going to work on a project which is going to use the SODAQ One board (https://shop.sodaq.com/en/sodaq-one-eu-rn2483-v3.html).

Sweet.

> In the supported hardware I see that the Adafruit Feather M0 Basic Prot is listed, which has this exact same microcontroller. I also read the Board Porting Guide and as I understand it basically I'd need to take the Adafruit configuration as a base and add these new components to the kconfiguration. All of the aspects related to the microcontroller are already there.

I did the port to the Adafruit Feather M0 Basic Proto. Let me know if I can help with the port for the SODAQ board.

> In particular I'm also wondering how to handle the LoRa microchip, since Zephyr has no LoRaWAN stack what would be the best way to handle the porting of this part?

Perhaps a simple solution could be to just add a sample application using the LoRaWAN chip over UART from the application layer?

Best regards,
Brix
-- 
Henrik Brix Andersen



Léonard Bise <leodido99@...>
 

Back again!

So this is weird because I got it working but without TX interrupts. RX interrupts work fine however as soon as I enable TX interrupts with uart_irq_tx_enable I enter an interruption loop.
Using uart_poll_out to send data works properly.

Also I just noticed that the example (samples/subsys/usb/cdc_arm) on which I was basing my test code doesn't respect what is written in the documentation. 
It is said that uart_fifo_read must only be used from within an interruption which is not the case in the test sample.

Does anyone know why I would enter the interruption loop on UART TX?

Best regards,
Léonard.

On 28 June 2018 at 10:42, Léonard Bise <leodido99@...> wrote:
I'm having difficulties trying to communicate with the LoRa UART interface.

I set it up like so:

pinmux.c

#if CONFIG_UART_SAM0_SERCOM2_BASE_ADDRESS
/* SERCOM2 LoRa UART on RX=PA13/pad 1, TX=PA12/pad 0 */
pinmux_pin_set(muxa, 12, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 13, PINMUX_FUNC_C);
#endif

board.h

/* SERCOM2 LoRa UART on RX=PA13/pad 1, TX=PA12/pad 0 */
#define CONFIG_UART_SAM0_SERCOM2_PADS \
(SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(0))

sodaq_one_v3.dts

&sercom2 {
status = "ok";
compatible = "atmel,sam0-uart";
current-speed = <57600>;
};

I created a test program similar to samples/subsys/usb/cdc_arm
In my test program I get the device like so.

lora = device_get_binding(ATMEL_SAM0_UART_42001000_LABEL);

I didn't find any documentation on how to determine the device names and I'm not sure it's the correct one, could someone enlighten me?

However as soon as I enable the RX or TX IRQ I'm stuck in an interruption loop so I guess something must be off with my configuration.

Best regards,
Léonard.



On 1 June 2018 at 19:03, Henrik Brix Andersen <henrik@...> wrote:
Hi Léonard

> On 18 May 2018, at 11.56, Léonard Bise <leodido99@...> wrote:
> I'm going to work on a project which is going to use the SODAQ One board (https://shop.sodaq.com/en/sodaq-one-eu-rn2483-v3.html).

Sweet.

> In the supported hardware I see that the Adafruit Feather M0 Basic Prot is listed, which has this exact same microcontroller. I also read the Board Porting Guide and as I understand it basically I'd need to take the Adafruit configuration as a base and add these new components to the kconfiguration. All of the aspects related to the microcontroller are already there.

I did the port to the Adafruit Feather M0 Basic Proto. Let me know if I can help with the port for the SODAQ board.

> In particular I'm also wondering how to handle the LoRa microchip, since Zephyr has no LoRaWAN stack what would be the best way to handle the porting of this part?

Perhaps a simple solution could be to just add a sample application using the LoRaWAN chip over UART from the application layer?

Best regards,
Brix
-- 
Henrik Brix Andersen