mux
Posts: 145
Joined: Sat Jan 13, 2018 3:52 am
Delivery Date: 13 Oct 2011
Leaf Number: 6177

Transmitting CAN messages to EV-CAN throws errors - correct parameters?

Sat Jun 16, 2018 9:58 am

I'm trying to transmit messages onto the EV-CAN. I've tested my hardware (a microcontroller controlling a Microchip MCP25625 CAN controller/transceiver combo) external to the car at 500kbaud and it works great. However, when I hook it up to my car's EV-CAN it receives messages just fine but when I try to transmit anything, it throws errors.

I assume this is due to wrong setup parameters in my CAN transceiver; either the baud rate or the PRSEG, PHSEG, SJW and Tq settings. My current settings are:

16MHz crystal
BRP = 1 (so Tq = 4MHz)
PRSEG = 1 Tq
PHSEG1 = 3 Tq
PHSEG2 = 3 Tq

Has anyone else successfully bidirectionally communicated on EV-CAN, and if so, what were your settings?

mux
Posts: 145
Joined: Sat Jan 13, 2018 3:52 am
Delivery Date: 13 Oct 2011
Leaf Number: 6177

Re: Transmitting CAN messages to EV-CAN throws errors - correct parameters?

Tue Jun 19, 2018 6:53 am

Alright, for posterity and for anyone else who's going to use Microchip CAN transceivers/controllers in the future for Nissan CAN bus stuff:

Known working configuration:
- 16MHz crystal
- CNF1 = 0xC0
- CNF2 = 0xF0
- CNF3 = 0x06

Which means: BRP = 0, SJW = 3, SAM = 1, PRSEG = 1 Tq, PHSEG1 = 7 Tq, PHSEG2 = 7 Tq

The CAN bus is relatively forgiving, but you WILL encounter sporadic errors with e.g. PRSEG=PHSEG1=PHSEG2=5.

The CAN bus is sufficiently 'slow' that any microcontroller capable of 16MHz SPI will be able to keep up just fine. I'm reading lots of registers on each interrupt (all possible error flags, the message itself, etc., probably 10+ registers per CAN message) and I can cope even with very heavy bus traffic during e.g. DTC resets. Hundreds of messages per second, something like 25-30% bus load.

Return to “LEAF CANBus”