[Ovmsdev] OVMS Poller module/singleton
Michael Balzer
dexter at expeedo.de
Sun Jan 26 19:51:35 HKT 2025
Simon,
Am 25.01.25 um 21:00 schrieb Simon Ehlen via OvmsDev:
> Are adjustments/improvements also necessary at 125KBPS for CAN2/3?
I've had a look at SAE J2284-1 for the 125 kbit timing, and it seems for
this speed, the esp-idf, the mcp_can lib and our current driver are
outside the spec.
SAE recommends a sync jump width of 3 for low (nq=8) and 4 for higher
resolutions, and single sampling at 62.5% (range 58.3…69.2%).
The esp-idf driver would use a SJW of 3 (would better be 4 as nq=20) and
single sampling at 80% (very late). The Arduino lib uses SJW=2 (too low)
and triple sampling at 75% (late).
Our current driver uses a SJW of 1 (much too low) and triple sampling at
56.25% (too early):
case CAN_SPEED_125KBPS:
cnf1=0x03; cnf2=0xf0; cnf3=0x86;
// BRP=3, PRSEG=1, PS1=7, PS2=7, SJW=1, BTLMODE=1, SAM=1, SOF=1,
WAKFIL=0 → Sample 3x at 9/16 = 56,25%
(Note: the current comment in the source is incorrect, the tq values
need each to be read as +1)
Possible SAE solutions for the MCP2515:
a)
case CAN_SPEED_125KBPS:
// SAE J2284-1:
// BRP=3, PRSEG=3, PS1=6, PS2=6, SJW=4, BTLMODE=1, SAM=0, SOF=1,
WAKFIL=0 → Sample point at 10/16 = 62.5%
cnf1=0xc3; cnf2=0xaa; cnf3=0x85;
b)
case CAN_SPEED_125KBPS:
// SAE J2284-1:
// BRP=3, PRSEG=3, PS1=7, PS2=5, SJW=4, BTLMODE=1, SAM=0, SOF=1,
WAKFIL=0 → Sample point at 11/16 = 68.8%
cnf1=0xc3; cnf2=0xb2; cnf3=0x84;
Please try.
Btw, if anyone would like to experiment: the Microchip timing calculator
needs to be set to 16 MHz (that's our MCP2515 clock), and you need to
add 0x80 to the cnf3 byte generated (that's the SOF flag, cannot be set
in the UI).
Regards,
Michael
--
Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
Fon 02330 9104094 * Handy 0176 20698926
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20250126/0f7e27eb/attachment.sig>
More information about the OvmsDev
mailing list