CAN sending breaks when inverters change baud rate
dalathegreat opened this issue · comments
Problem description
Some inverters (like Sungrow) like to switch between 250kbps and 500kbps at startup, to see what type of battery is connected to it. This is a huge problem for us, since it can put the CAN bus into a faulted state that never recovers.
Suggested solution
From RPI pelle_c
Believe I got this fixed now in rpi-version. Had to do a number of checks, and if one of them didn't pass the can-interface is restarted ("releasing notifiers", interface down/up), after 1-5 seconds (random).
Check that sending message returns ok
In addition, following is done on interval:
Check if the interface is reported as up
Check that the tx_counter on tne interface isn't the same as it was 60 secs ago
User @Newevg is piloting an attempted fix for this, two lines of code added to the ESP32CAN.cpp
file;
ESP32Can.CANStop();
ESP32Can.CANInit();
Let's see if it helps anything long term!
@Newevg , did this help?
Setting this as solved. New implementation merged in #260 (Target to 2.8.0 release)
We now recover in 20ms, instead of waiting 2000ms. This approach allowes baudrate switching to not break our emulator as easily.
If future issues pop up related to baudrate switching, the PR has an additional approach we can try.