I cloned the OBDII module when I started work on the C6 Corvette and 2nd gen CTS modules. Trying to debug my C6 Corvette canbus issues I'm not understanding how OBD polling works. What I see when I look at vehicle_obdii.cpp is that there is a list of pids that are polled. However, OvmsVehicleOBDII::IncomingPollReply() is the only place that *enables* polling: case 0x0c: // Engine RPM if (value2 == 0) { // Car engine is OFF PollSetState(0); StandardMetrics.ms_v_env_handbrake->SetValue(true); StandardMetrics.ms_v_env_on->SetValue(false); StandardMetrics.ms_v_pos_speed->SetValue(0); StandardMetrics.ms_v_env_charging12v->SetValue(false); } else { // Car engine is ON PollSetState(1); StandardMetrics.ms_v_env_handbrake->SetValue(false); StandardMetrics.ms_v_env_on->SetValue(true); StandardMetrics.ms_v_env_charging12v->SetValue(true); } break; I can only assume "engine RPM" canbus frames are always sent by the vehicle (not unreasonable); but then I don't understand why we are polling for it? I guess I would expect ms_v_env_on state changes to happen in SOvmsVehicleOBDII::IncomingFrameCan1(). But maybe OvmsVehicleOBDII::IncomingPollReply() gets engine RPM frames since they are on the list of things we're polling for? So if we didn't handle them in IncomingPollReply() we'd have to add a IncomingFrameCan1() routine? Playing around with savvycan I find it's possible to have the C6 Corvette, with engine running, to not be "on" but still send canbus frames to savvycan (at least until *it* gives up and disconnects). This makes me think I'm getting into a situation where ovms does not detect that the car is on but not because the canbus is not working due to logic errors on my part. Certainly "can can1 status" reports a similar number of tx fails when compared to my working vehicle (2nd gen Cadillac). Craig
Craig, the initial poll state is set by the constructor to 0. Poll state 0 enables polling of the VIN (every 999 seconds) and the engine RPM (every 10 seconds) entry of the polls list. PollSetState(0) does not disable the polling, it just sets the state to 0. You can currently use up to four states. I wrote some documenting comments on the poller in vehicle_poller.cpp and vehicle.h. A developer manual page is still todo. You can also hook into the CAN error reporting or query the error state from PollerStateTicker() to detect when the bus goes offline. See the Hyundai code for an example on this. Regards, Michael Am 02.10.22 um 04:17 schrieb Craig Leres:
I cloned the OBDII module when I started work on the C6 Corvette and 2nd gen CTS modules. Trying to debug my C6 Corvette canbus issues I'm not understanding how OBD polling works.
What I see when I look at vehicle_obdii.cpp is that there is a list of pids that are polled. However, OvmsVehicleOBDII::IncomingPollReply() is the only place that *enables* polling:
case 0x0c: // Engine RPM if (value2 == 0) { // Car engine is OFF PollSetState(0); StandardMetrics.ms_v_env_handbrake->SetValue(true); StandardMetrics.ms_v_env_on->SetValue(false); StandardMetrics.ms_v_pos_speed->SetValue(0); StandardMetrics.ms_v_env_charging12v->SetValue(false); } else { // Car engine is ON PollSetState(1); StandardMetrics.ms_v_env_handbrake->SetValue(false); StandardMetrics.ms_v_env_on->SetValue(true); StandardMetrics.ms_v_env_charging12v->SetValue(true); } break;
I can only assume "engine RPM" canbus frames are always sent by the vehicle (not unreasonable); but then I don't understand why we are polling for it? I guess I would expect ms_v_env_on state changes to happen in SOvmsVehicleOBDII::IncomingFrameCan1(). But maybe OvmsVehicleOBDII::IncomingPollReply() gets engine RPM frames since they are on the list of things we're polling for? So if we didn't handle them in IncomingPollReply() we'd have to add a IncomingFrameCan1() routine?
Playing around with savvycan I find it's possible to have the C6 Corvette, with engine running, to not be "on" but still send canbus frames to savvycan (at least until *it* gives up and disconnects). This makes me think I'm getting into a situation where ovms does not detect that the car is on but not because the canbus is not working due to logic errors on my part. Certainly "can can1 status" reports a similar number of tx fails when compared to my working vehicle (2nd gen Cadillac).
Craig _______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-- Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
On 10/2/22 01:27, Michael Balzer wrote:
the initial poll state is set by the constructor to 0. Poll state 0 enables polling of the VIN (every 999 seconds) and the engine RPM (every 10 seconds) entry of the polls list.
PollSetState(0) does not disable the polling, it just sets the state to 0. You can currently use up to four states.
I wrote some documenting comments on the poller in vehicle_poller.cpp and vehicle.h. A developer manual page is still todo.
You can also hook into the CAN error reporting or query the error state from PollerStateTicker() to detect when the bus goes offline. See the Hyundai code for an example on this.
Thanks, that got me aimed in a useful direction. I spent some too-long-postponed time reverse engineering the PIDs the Corvette spontaneously transmits; it was easy to pick out the vin and something that may or may not be rpm but definitely tells me when the engine is running. Engine off: 1664745342.332392 1R11 308 00 e8 00 00 20 00 ff ^^ ^^ ^ Engine on, about 2000 RPM: 1664745361.231876 1R11 308 00 e8 8b 00 21 00 ff ^^ ^^ ^ Engine on, idling at about 650 RPM: 1664745370.031792 1R11 308 00 e8 6a 00 21 00 ff ^^ ^^ ^ Now that I'm not polling for rpm every 10 seconds when the car is off, can1 Tx ovrflw/Tx fails are both staying at zero; I started to worry that filling up the transmit queue while the car was parked/off was causing me to lose the ability to transmit anything once it was on again. Now it's no longer a potential issue. Craig OVMS# can can1 status CAN: can1 Mode: Active Speed: 500000 DBC: none Interrupts: 21116 Rx pkt: 21113 Rx ovrflw: 0 Tx pkt: 8 Tx delays: 0 Tx ovrflw: 0 Tx fails: 0 Err flags: 0x00000000 Rx err: 0 Tx err: 0 Rx invalid: 0 Wdg Resets: 0 Wdg Timer: 7 sec(s) Err Resets: 0
participants (2)
-
Craig Leres -
Michael Balzer