Topics

How to use "Serial CAN Bus Module" #uart #driver #can


s9gosich@...
 

Hi all,

I’m new to zephyr and need some help.

I have a nrf52dk board and want to use this ( https://www.longan-labs.cc/1030001.html ) serial to CAN device. I was able to test this with an Arduino and this library ( https://github.com/Longan-Labs/Serial_CAN_Arduino ). Now, I’m a bit lost how to use it with Zephyr.
Can I import the arduino library into Zephyr? Or do I need to rewrite the library? Or would it be easier to buy some othe CAN module which is supported by Zephyr?


Thank you!

Govinda


Lawrence King
 

I have used the Longan module with Zephyr on nrf52840. I connected it to a Serial, then modified the Longan library to compile and work under Zephyr.

 

This isn’t everything you need (missing the .h includes, and the uart1_xx functions) but should get you started.

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of s9gosich@...
Sent: Wednesday, August 12, 2020 11:52 AM
To: users@...
Subject: [Zephyr-users] How to use "Serial CAN Bus Module" #can #driver #uart

 

Hi all,

I’m new to zephyr and need some help.

I have a nrf52dk board and want to use this ( https://www.longan-labs.cc/1030001.html ) serial to CAN device. I was able to test this with an Arduino and this library ( https://github.com/Longan-Labs/Serial_CAN_Arduino ). Now, I’m a bit lost how to use it with Zephyr.
Can I import the arduino library into Zephyr? Or do I need to rewrite the library? Or would it be easier to buy some othe CAN module which is supported by Zephyr?

 

Thank you!

Govinda


s9gosich@...
 

@Lawrence King

Thank you for the code!


@All

I tried the last few days to get it working but I don’t know how to use a second UART. I’m using the nRF52832dk board which has only “uart0” defined in the Devicetree (see ~/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts and ~/zephyr/dts/arm/nordic/nrf52832.dtsi). Since uart0 is already being used I want to define an “uart1” as was used in the code by Lawrence King for nRF52840 (which supports “uart1” in the Devicetree). But as I understand it at the moment, this is difficult without deep knowledge about the Hardware and Devicetree. 

How can I solve this? Is there an easy path I haven’t found. Something like SoftwareSerial in Arduino?

Can I define an “uart1” with an “.overlay” file in my project folder? Are there examples for this?

Do I have to edit the Devicetree files in the ~/zephyr/dts folder?

Thank you!