Tearing my hair out on this one.
Have a new PH4 mini sat on my desk with a Matekys UVCAN airspeed sensor and a Here3 set to CAN.
The sensor and GPS works perfectly as per the documentation if I plug it into a cube orange.
On the PH4Mini I can not get the devices to show up in SLCAN, I have even tried swapping the can high and low as I know there was a hardware bug on older models but nothing seems to work.
has anyone ever successfully managed to get CAN to work on a PH4Mini? Any ideas of how I might make it work?
Latest mission planner BETA.
I have set
CAN_D1 Protocol: 1
On the cube orange I get extra parameters that I do not see on the PH4 Mini. This includes Can_P1_bitrate, CAN_p1 Debug…
I think the problem is effectively a race condition in the airspeed initialisation. I managed to get it to work by adding a delay between CAN init call and the airspeed initialisation in ArduPlane/system.cpp. I just added
hal.scheduler->delay(1000); right before the
It’s interesting that this isn’t seen on the Orange. Maybe its CAN stuff comes up faster or other init stuff is slower.
When the airspeed sensor is being initialised, it wants to see that the “module” has a valid pointer to an
AP_UAVCAN instance. (See line 51 of AP_Airspeed_UAVCAN). However, that only happens after a UAVCAN message is received (see line 100). If the
init() (and subsequently
probe()) call happens before a message is received, the airspeed backend isn’t ever set up properly.
Ideally, some sort of continuous attempt would be made until a message came through. Maybe a timeout in the probe call?
It’s mentioned as a pain point in this rather vintage issue: ArduPilot#12165
slow CAN peripheral boot causes issues with sensor detection (especially mag, baro and airspeed)
Also for the extra debug parameters
AP_CAN_DEBUG needs to be set in
libraries/AP_BoardConfig/AP_BoardConfig_CAN.h. Unclear why it would be set for one board but not the other. I gave up trying to find it in the build system.