KJPR
(Prince)
March 7, 2023, 6:47am
1
Hello,
I am new to UAVCAN / Cyphal protocol. I bought a Battery Management System (BMS) board named RDDrone-BMS-772 from NXP which supports UAVCAN V1.0. I want to read the CAN data shared by BMS in PC.
I tried to connect this board to PX4 Cube Orange Autopilot, it didn’t work. Although, Zubax ESC and Packet digital MPPT works fine through UAVCAN in Cube Orange. I guess Cyphal is still not supported in Cube Orange.
Can Someone suggest an USB-CAN adapter to read UAVCAN V1.0 data in PC?
or Can I use Microchip’s CAN bus analyzer (which supports CAN2.0B) for this?
Thanks in advance…
Cyphal/CAN is supported in PX4.
For a general-purpose adapter, I recommend Zubax Babel .
KJPR
(Prince)
March 7, 2023, 8:52am
3
Thanks for your quick reply.
I will explore purchasing Babel.
With regard to Cyphal support in PX4, in Mission planner under CAN protocol selection field DroneCAN option is available along with Piccolo, KDECAN etc. but Cyphal is not available.
When DroneCAN is selected, the device is not getting identified.
Thanks & Regards…
It sounds like you’re using ArduPilot, not PX4.
KJPR
(Prince)
March 7, 2023, 9:20am
5
Yes… Sorry for misleading.
So, Cyphal is not supported in Ardupilot?
Thanks & regards…
Well, there’s this; a comment in support of this changeset would be appreciated:
ArduPilot:master
← PonomarevDA:pr-uavcan-v1
opened 07:52AM - 31 Mar 22 UTC
This PR adds a minimal implementation of Cyphal (uavcan v1.0) for ESC controllin… g.
It has the following required for any application functions:
- Node heartbeat (the node publishes uavcan.node.Heartbeat)
- Generic node information (the node response on uavcan.node.GetInfo.1.0 request)
- Register interface (response on uavcan.register.Access.1.0 and uavcan.register.List.1.0)
I also implemented templates for the following data types, but they do nothing yet. They might be completed if someone needs them or even removed for a while:
- uavcan.node.port.List (sends all supported port id)
- uavcan.node.ExecuteCommand (handles requests on restart or save parameters commands)
It also interacts with all necessary for ESC controlling data types, such as:
- reg.udral.service.actuator.common.sp.Vector4.0.1
- reg.udral.service.common.Readiness.0.1
- reg.udral.physics.electricity.PowerTs_0_1
- reg.udral.service.actuator.common.Feedback_0_1
- reg.udral.service.actuator.common.Status_0_1
- reg.udral.physics.dynamics.rotation.PlanarTs_0_1
All ESC related data types have non-fixed subject identifier. It is handled by the register interface that is based on AP_Param library. Since the implementation doesn't support automatically port id enumeration, you need to either manually or using a script from external server set their id (for ardupilot and for esc's).
Typical set of parameters and corresponded registers might be as on the picture below:
![ardupilot_params](https://user-images.githubusercontent.com/36133264/160892348-bdcf6122-24b3-4ac9-b768-44970b7c4562.png)
I also forwarded esc telemetry to the corresponded MAVLink message:
![esc_telem](https://user-images.githubusercontent.com/36133264/160892583-821a31f1-431a-4174-bb10-59983c528031.png)
The implementation is based on `libcanard`, `o1heap`, `public_regulated_data_types` repositories which are added as submodules. It also uses `nunavut` for generating the code from DSDL. I tried to implement it in the similar way as AP_UAVCAN is implemented. You may use both versions of UAVCAN simultaneously, but on different CAN buses only.
According to the build summary comparison, on CUAV v5 the current branch used 14244 bytes of flash memory more than master branch. Although free flash on this branch on this hardware is 317088 bytes.
The firmware was tested on real copter based on cuav v5. I attached here a few flight examples [first](https://youtu.be/wBNh1XV1EMQ) and [second](https://youtu.be/FE_kxwhicWM) and corresponded [log files](https://drive.google.com/drive/folders/11hBPpcgdHG1a3gUMJ8z9DtMmeTAbuwBR?usp=sharing). I used Holybro kotleta20 ESCs based on sapog v3 firmware. Here should be noticed that I tested it before merging master branch into this branch. I may provide more tests in future. I also tried `Tools/scripts/build_all.sh` and it's ok.
I also want to notice that even if it was tested it is a still just a first version of implementation. It has a few assumptions, for example:
- it is expected to use it only for quadcopter since it uses exactly 4 ESCs,
- it works only on first CAN bus now.
I didn't test it on other hardware.
Any feedback is welcome.
1 Like