Hereflow UAVCAN not working

I’m trying to get the hereflow to work but I’m getting an error -13. I just connected the hereflow to can1/2 and set UAVCAN_ENABLE=2 according to the manual.

Dmesg is showing:
WARN [uavcan] CentralizedServer init: -13
WARN [uavcan] Node init failed: -13
ERROR [uavcan] Firmware Server Failed to Start -13

uavcan status is showing multiple sensor drivers to be active but no online node is shown.

I checked for SD card issues and reformatted to be sure, but nothing helped.

I’m using the latest stable px4 stack (PX4 Pro Firmware v1.12). I tried multiple pixhawk-cubes of profiCNC (orange, black) with different carrier boards (normal, mini). In every configuration I’m getting the same error.

top is showing

PID COMMAND CPU(ms) CPU(%) USED/STACK PRIO(BASE) STATE FD
0 Idle Task 189574 74.456 276/ 512 0 ( 0) READY 0
1 hpwork 0 0.000 344/ 1260 249 (249) w:sig 0
2 lpwork 100 0.000 1112/ 1612 50 ( 50) w:sig 0
492 mavlink_rcv_if0 391 0.181 2816/ 4068 175 (175) w:sem 6
4 wq:manager 0 0.000 376/ 1252 255 (255) w:sem 3
490 log_writer_file 0 0.000 368/ 1164 60 ( 60) w:sem 3
17 dataman 26 0.000 760/ 1204 90 ( 90) w:sem 4
19 wq:lp_default 63 0.090 812/ 1700 205 (205) w:sem 3
29 wq:hp_default 2044 0.815 1028/ 1900 240 (240) w:sem 3
140 wq:SPI1 8206 3.260 1492/ 2332 253 (253) w:sem 3
143 wq:SPI4 15107 5.978 1556/ 2332 250 (250) w:sem 3
198 wq:nav_and_controllers 12815 5.072 5296/ 7196 241 (241) w:sem 3
199 wq:rate_ctrl 4667 1.902 1128/ 1660 255 (255) w:sem 3
205 commander 1406 0.543 1448/ 3212 140 (140) w:sig 6
206 commander_low_prio 2 0.000 692/ 2996 50 ( 50) w:sem 6
215 wq:uavcan 1713 0.724 1736/ 2996 239 (239) w:sem 3
220 mavlink_if0 6950 2.989 1888/ 2572 100 (100) READY 6
276 gps 66 0.090 1016/ 1676 205 (205) w:sem 4
308 mavlink_if1 1388 0.543 1840/ 2484 100 (100) w:sig 4
309 mavlink_rcv_if1 358 0.090 2816/ 4068 175 (175) w:sem 4
331 px4io 3690 1.449 980/ 1484 237 (237) w:sem 4
447 wq:attitude_ctrl 964 0.452 1236/ 1668 242 (242) w:sem 3
466 navigator 97 0.090 936/ 1764 105 (105) w:sem 5
487 logger 414 0.181 2128/ 3644 230 (230) w:sem 3
493 mavlink_shell 0 0.000 784/ 2020 100 (100) w:sem 3
495 top 85 0.362 1480/ 2028 239 (239) RUN 3

Processes: 26 total, 3 running, 23 sleeping, max FDs: 15
CPU usage: 24.82% tasks, 0.72% sched, 74.46% idle
DMA Memory: 5120 total, 1024 used 1536 peak
Uptime: 253.750s total, 189.574s idle

Does anyone have an idea of a possible root cause?

often I had not enough ram to use uavcan
Type free and there ist something above 15K needed to properly use uavcan sensors. Or the two can pins are exchanged (CL, CH)

Hey, @taileron Thanks for your reply.

Flipping the two CAN wires (CL,CH) can not harm the sensor or the cube? The sensor was accompanied with a connector cable, which I assume is correct.

Furthermore, top showed the following line: DMA Memory: 5120 total, 1024 used 1536 peak

The order of the wires should be correct by default, but if they are reversed, the error message mentioned above would appear, otherwise nothing can happen to the components. Typing “free” into the mavlink shell shows the memory status. “uavcan status” should show all connected uavcan devices. DMA usage is another department. Attention, these errors also occur if the node ID of the FC is not set to 1!

Hey @taileron, I got around to install arducopter and there both the optical flow and range sensor are producing consistent data. This excludes any hardware issues. When enabling the uavcan (to automatic) I’m getting the following response on the free command:

            total       used       free    largest
Umem:       232288     219792      12496       9168
Prog:      2097152    1966080     131072          0

node id of FC is set to 1

12.5K might already be a little too low.
For testing, USB could be disconnected or another Mavlink instance could be removed.
I have 2 HereFlows in operation on the PixRacer and X2.1-777. Unfortunately, the range sensor has a range of less than 0.5 m outdoors. Indoors it works.

Hey Thanks for the input. In the mean time I have tested the sensor with an Arducopter firmware. I was able to get it to work and retrieve consistent data.

I have installed older px4 firmware versions where the number of available UAVCAN and other drivers was lower, and therefore taking less memory. Unfortunately, also there the hereflow node was not detected when running the “uavcan status” command.

Could you give more details of your working setup? Which firmware, hardware, …

I used it since V 1.11 up to current master.
With X2.1-777 (F7 based) and Zero H7 OEM (H7 based) it always worked without any tuning.
With all F4 based (PixRacer in my case) it always needs further tuning to have enough ram (20k) and it is necessary to limit oneself to one mavlink instance (type: mavlink status) → e.g. radio telemetry and (even not physically connected) USB simultaneously takes way too much ram and doesn´t work. Work is underway (pr-mavlink_usb_start) to automatically shut down the USB Mavlink instance if there is no connection. That would free up additional 15k.
RAM consumption:
Mavlink telemetry 16.6K
UAVCAN sensors 33K
→ without telemetry, uavcan there should be 65 … 70K ram available

Hereflow doesn’t work in my setups if connected to second uavcan → e.g. in case of a mini carrier board that doesn’t offer the primary uavcan port.