[Ovmsdev] OVMS Poller module/singleton
Michael Geddes
frog at bunyip.wheelycreek.net
Sun Jan 26 08:25:28 HKT 2025
I think this is kinda what it's always done with Ioniq5, but this is with
the timing patch applied.. if I go from State=0 .. so no polling which
means NOTHING received on the CAN bus, to State=1 (Vehicle on - lotsa
polling including every second) where it starts polling, I get:
E (36101885) can: can1: intr=18642 rxpkt=11924 txpkt=6700 errflags=0x8000d9
rxerr=0 txerr=8 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18646 rxpkt=11924 txpkt=6700 errflags=0x8000d9
rxerr=0 txerr=40 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18648 rxpkt=11924 txpkt=6700 errflags=0x8000d9
rxerr=0 txerr=56 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18650 rxpkt=11924 txpkt=6700 errflags=0x8000d9
rxerr=0 txerr=72 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18652 rxpkt=11924 txpkt=6700 errflags=0x8000d9
rxerr=0 txerr=88 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18654 rxpkt=11924 txpkt=6700 errflags=0x8040d9
rxerr=0 txerr=104 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18655 rxpkt=11924 txpkt=6700 errflags=0x8040d9
rxerr=0 txerr=112 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
E (36101885) can: can1: intr=18659 rxpkt=11924 txpkt=6700 errflags=0x204800
rxerr=0 txerr=128 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0
errreset=1
.... followed by
E (36145665) esp32can: can1 stuck bus-off error state (errflags=0x00040c00)
detected - resetting bus
And then things seem to be good from there. I have bus 1 registered as
active 500kbps
*RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS);*
//.ichael
On Sat, 25 Jan 2025 at 09:58, Mark Webb-Johnson via OvmsDev <
ovmsdev at lists.openvehicles.com> wrote:
> Nice work. Thanks.
>
> Mark
>
> > On Jan 25, 2025, at 2:52 AM, Michael Balzer via OvmsDev <
> ovmsdev at lists.openvehicles.com> wrote:
> >
> > I was too quick on this conclusion:
> >
> >> Am 19.01.25 um 12:48 schrieb Michael Balzer via OvmsDev:
> >> Regarding CAN timing, our ESP32CAN/SJA1000 configuration is mostly
> according to the SAE/CiA recommendations, with one exception: we generally
> enable multi (triple) sampling, regardless of the bus speed
> >
> > I trusted this CAN timing tool:
> https://www.esacademy.com/en/library/calculators/sja1000-timing-calculator.html
> > …because it claims it applies the CiA recommendation. That turns out to
> either be not true or to be different from the SAE recommendation.
> >
> > I've had another look at the SAE J2284-3 spec.
> >
> > TL;DR: our sampling point is too late and our tolerance for timing
> variances of other devices on the bus is too low, at least for the usual
> 500 kbit/s bus speed.
> >
> > For 500 kbit/s, SAE J2284-3 defines SJW=3 and TSEG2=3 at tq=125ns, or
> SJW=3 and TSEG2=3…5 at tq=100ns, resulting in the sampling point being in
> the range 75-85%.
> >
> > Our driver currently uses tq=125ns with SJW=2 and TSEG2=2, sampling at
> 87.5%, so clearly outside the recommendation.
> >
> > The ESP-IDF driver configuration uses the tq=100ns setup, and places
> TSEG2 at 4:
> > #define CAN_TIMING_CONFIG_500KBITS() {.brp = 8, .tseg_1 = 15, .tseg_2
> = 4, .sjw = 3, .triple_sampling = false}
> > → bus clock = .brp / 80 MHz → tq=100ns, with sampling at tq 16 of 20 =
> 80% -- this is exactly as recommended by SAE.
> >
> > I now test this configuration in my Mii, so far without issues.
> >
> > To test this timing, apply the attached patch, this also includes the
> SAE 500 kbit/s timing for can2/3.
> >
> > Regards,
> > Michael
> >
> > --
> > Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
> > Fon 02330 9104094 * Handy 0176 20698926
> >
> > <can1-sae.diff>
> > _______________________________________________
> > OvmsDev mailing list
> > OvmsDev at lists.openvehicles.com
> > http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20250126/059c8def/attachment.htm>
More information about the OvmsDev
mailing list