CANable-MKS
CANable-MKS copied to clipboard
buggy CAN transceiver init behavior
Hi there, I have a MKS-CANable v2.0 PRO which i think has slightly buggy behavior on init/reset. I'm using the candleLight firmware blob from this repo (https://github.com/makerbase-mks/CANable-MKS/tree/main/Firmware/CANable%20V2.0), but i think the problem is caused by a hardware bug that applies to any firmware.
The problem is that if you power cycle the CANable2 too quickly, it boots into firmware bootloader mode instead of into the firmware application. I think this because the STM32G431 uses the same pin, PB8-BOOT0
, for both CAN_RX
and BOOT0
, and the ADM3050 CAN transceiver does not reset correctly during short power cycles.
I have some scope traces that demonstrate the problem. The scope traces show the following channels:
- Yellow: ADM3050 Vdd1 (power to the logic side of the isolated CAN transceiver)
- Blue: 3.3v rail powering the STM32
- Purple: the
PB8-BOOT0
pin
Normal power-on - good
All three signals start out low (powered down). I connect the USB cable and the 3.3V rail (channel 2, blue) immediately stabilizes, which causes the STM32 to start booting. The power supply to the ADM3050 CAN transceiver has not stabilized yet (channel 1, yellow), and it is not asserting
CAN_RX
, so the booting STM32 sees logic false on its PB8-BOOT0
pin (channel 3, purple). This causes the STM32 to boot into the firmware application as desired, so this situation is good.
Long power cycle - good
Here I start with the CANable2 powered up and working, and i do a "long" power cycle, approximately 1,500 ms. At the left we see all three signals up and running normally. Note that the
CAN_RX
output from the ADM3050 is in the high state, indicating the CAN bus is in the recessive state (idle, or transmitting a logic 0). This is normal. I remove power, and all three signals drop to 0V. After 1,500 ms I reapply power, and the board boots in the same way as the "Normal power-on" above, as desired.
Short power cycle - bad
This is where things go wrong. Here again I start with the board powered and running normally. Again i remove power, and all three signals go to 0V. But then i reapply power after only ~300 ms. Note that the logic power supply for the ADM 3050 immediately stabilizes, and the CAN transceiver immediately asserts
CAN_RX
. The booting STM32 sees logic true on its PB8-BOOT0
input pin, and incorrectly boots into the firmware boot loader instead of into the firmware application.
At this point the board does not function as a USB to CAN adapter, and is instead sitting in its bootloader waiting to receive a new firmware application binary to write to its flash storage. The only way to restore functionality here is to do a long power cycle, so that the ADM3050 resets correctly and de-asserts CAN_RX
, so that the STM32 sees a logic false on its PB8-BOOT0
pin and boots into the firmware application.