EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2129 (SW)-CANBus Error troubleshooting: RX Passive Error, REC = 128

Started by lawzaz April 7, 2013
Hi fellow forum-goers,

I'm trying to add a general-purpose CAN to UART function to an LPC2129 setup. CAN1 works at 250 and 500kbps, so I modified my code to add CAN2 but am experiencing difficulty. I'm hoping one of you gurus is willing to look over my configuration.

CAN2 is supposed to be "scalable" to any of several baud rates, but I am testing on 33.3kbps on a SINGLE WIRE network. I am using a dual wire CAN transceiver (SN65HVD232) with CANL tied to GND (I'm modifying hardware purchased in bulk so changing transceivers is something I would like to avoid). In testing another device with a MCP2551 in the same configuration (CANL to GND), the bus works fine. However, when using the LPC2129 and the TI transceiver, I get RX passive errors.

If I keep the CAN2 controller in reset, the bus is happy and never flags an error. Same goes for listen-only mode. However, as soon as I enable (C2MOD=0x00) the controller, the errors accumulate rapidly until BUS off. I should note that I am "hot-busing" and adding the transceiver to the bus while ~10 nodes are regularly transmitting. The transceiver is supposed to be capable of this.

What might I be missing? I'm not 100% confident on my baud rate calculations -- they're all based off of the timing I used for the 500 and 250kbps settings. My VPB is 60MHz.

Thank you in advance for helping a novice to debug!



An Engineer's Guide to the LPC2100 Series

Hi lawzaz,

Where did you find in the datasheet that the TI type SN65HVD232 can
can be used in single wire network like in your test setup ?
Same question for the MCP2551 ...

Just out of curiosity :
can both high speed CAN drivers actually work at the bitrate of 33K3,
I mean are they supposed to work reliable at a bitrate 33K3 ?

Br,

Armand
On 08.04.2013 01:03, lawzaz wrote:
> ... I am using a dual wire CAN
> transceiver (SN65HVD232) with CANL tied to GND ...

If you are using CANH/CANL terminology in the same sense as in
SN65HVD232 data sheet, then the transceiver might see the bus as always
dominant. That depends on voltages in your one wire bus. The CANL must
be roughly the same or higher than the CANH in idle or recessive state.

If you are using the terms in other way, then the transceiver might not
see the dominant state sent by itself or at all.

Probably it would be better to tie CANL to halfway of the bus voltage swing.

What are the voltages in your bus in recessive and dominant states?

--

Timo
Il 08/04/2013 00:03, lawzaz ha scritto:
> Hi fellow forum-goers,
>
> I'm trying to add a general-purpose CAN to UART function to an LPC2129
> setup. CAN1 works at 250 and 500kbps, so I modified my code to add
> CAN2 but am experiencing difficulty. I'm hoping one of you gurus is
> willing to look over my configuration.
>
> CAN2 is supposed to be "scalable" to any of several baud rates, but I
> am testing on 33.3kbps on a SINGLE WIRE network. I am using a dual
> wire CAN transceiver (SN65HVD232) with CANL tied to GND (I'm modifying
> hardware purchased in bulk so changing transceivers is something I
> would like to avoid). In testing another device with a MCP2551 in the
> same configuration (CANL to GND), the bus works fine. However, when
> using the LPC2129 and the TI transceiver, I get RX passive errors.

From the datasheet and my experience your TI transceiver doesn't support
single wire CAN. I used the old AU5790 from Philips/NXP and TJA1054T
fron NXP. There are other parts from ON and Freescale also. In general
terms you shouldn't search for an high speed CAN transceiver because
single wire CAN is a low speed. Specifically there are 3 relevant
standards: ISO11898-2 about high speed CAN medium access unti,
ISO11898-3 CAN Low speed and fault tolerant and SEA2411 single wire.
Single wire CAN bus is part of the fault tolerant CAN bus and it is
specified between 40 to 125 kbit/s. So the drivers should be compliant
and referred as LOW SPEED FAULT TOLERANT CAN TRANSCEIVERS.
I don't know about high speed CAN transceivers working in single wire mode.
Anyway there is a different problem: termination for high speed CAN bus
and fault tolerant CAN bus are totally different. Due to the different
types of terminatio you can't use high speed and low speed CAN
transceiver to work in the same network.

This is a good starting point:
http://www.nxp.com/documents/application_note/AH_FTCAN3.pdf
Hi all, and thanks! Your replies are really useful. I'll look over the datasheet more, but do realize that this is intended to be a bit of a hack so I can use existing hardware in a test configuration.

Armand:
The datasheet never said SW-CAN was OK -- I'm basing this on some hacks used in the car computer world that have been around for ages. Not meant for reliability at all. I'll go check the datasheets to see if the baud rate is supported.

Timo:
Good thinking! I think my MCP-based hardware was running off a 5V regulator. This new hardware is 3V3. I wonder if that could be a contributor. The network I am connecting to is 0-5V. As for "who said it would be a good idea" to connect CANL to GND, it's kind of an old wives tale around car forms -- and I'm hoping to connect this to GMLAN.

M. Manca:
Thank you for looking over the datasheet. I know the device doesn't "officially" support SW-CAN. I am trying to make existing hardware work with a new type of network, even if it isn't 100% reliable -- mostly to see if I can do it. As for termination, I am connecting to a network that has been pre-terminated, so this should be a non-issue. Good note about low speed vs. high speed, and I'll read your document - though it seems to me like the high speed hardware should be more than capable of being downclocked.

My guess is that the most likely problem here is the CANL voltage (or maybe CANH?) so I'll test it out with a different supply. Might tying CANL to 1V8 work if the bus is expecting 0-5V SW-CAN?

Thanks again for helping me hack my way through this!
On 08.04.2013 14:39, lawzaz wrote:
> My guess is that the most likely problem here is the CANL voltage (or
> maybe CANH?) so I'll test it out with a different supply. Might tying
> CANL to 1V8 work if the bus is expecting 0-5V SW-CAN?

I think it might work (provided that the recessive state on bus is 0V -
or less than 1V8). It depends on your single wire receiver threshold.
SN65HVD232 should pull CANH to at least 2.45V when sending dominant bit.

--

Timo
> I think it might work (provided that the recessive state on bus is 0V -
> or less than 1V8). It depends on your single wire receiver threshold.
> SN65HVD232 should pull CANH to at least 2.45V when sending dominant bit.

According to NXP AN2005 (http://www.nxp.com/documents/application_note/AN2005.pdf) it looks like it should be swinging to GND when recessive (see page 4). Ignoring possible wave shaping issues, tying CANL to GND and reading CANH should work.

What are some next debug steps to try? It could be that 3V3 isn't high enough for CANH, but the TH8056 datasheet (the existing devices use these) specifies that it is 3V3 and 5V compatible.

Do my settings for C2BTR look OK (0x3E005A)? Is there a way to "silently" join the BUS?
Il 08/04/2013 20:14, lawzaz ha scritto:
> According to NXP AN2005
> (http://www.nxp.com/documents/application_note/AN2005.pdf) it looks
> like it should be swinging to GND when recessive (see page 4).
> Ignoring possible wave shaping issues, tying CANL to GND and reading
> CANH should work.

AN2005 is valid for AU5790 transceiver not for others.
Il 08/04/2013 13:39, lawzaz ha scritto:
> Hi all, and thanks! Your replies are really useful. I'll look over the
> datasheet more, but do realize that this is intended to be a bit of a
> hack so I can use existing hardware in a test configuration.
>
> Armand:
> The datasheet never said SW-CAN was OK -- I'm basing this on some
> hacks used in the car computer world that have been around for ages.
> Not meant for reliability at all. I'll go check the datasheets to see
> if the baud rate is supported.

What you say is not true. What is true is that there are CAN
transceivers with some features not documented in the standard datasheets.

> Timo:
> Good thinking! I think my MCP-based hardware was running off a 5V
> regulator. This new hardware is 3V3. I wonder if that could be a
> contributor. The network I am connecting to is 0-5V. As for "who said
> it would be a good idea" to connect CANL to GND, it's kind of an old
> wives tale around car forms -- and I'm hoping to connect this to GMLAN.
>
> M. Manca:
> Thank you for looking over the datasheet. I know the device doesn't
> "officially" support SW-CAN. I am trying to make existing hardware
> work with a new type of network, even if it isn't 100% reliable --
> mostly to see if I can do it. As for termination, I am connecting to a
> network that has been pre-terminated, so this should be a non-issue.
> Good note about low speed vs. high speed, and I'll read your document
> - though it seems to me like the high speed hardware should be more
> than capable of being downclocked.

I think you didn't understand the important points.
1. Low speed faulto tolerant and single wire CAN networks need
terminations at every node, instead an high speed CAN bus needs
terminations at the 2 ends. So in low speed and single wire CAN buses
you need to know not only the bus length but also the number of nodes,
adding one more node requires to change every terminator resistor in the
bus.
2. You shouldn't use a transceiver that is not clearly designed to be
used in single wire CAN networks or for low speed CAN networks in that way.
3. You shouldn't connect nodes compliant with high speed CAN bus
together with low speed nodes and single wire nodes. They can't be
intermixed. Please refer to ISO11898-1, 2, 3 and 5.

> My guess is that the most likely problem here is the CANL voltage (or
> maybe CANH?) so I'll test it out with a different supply. Might tying
> CANL to 1V8 work if the bus is expecting 0-5V SW-CAN?
>

You should read SAE J2411 that specifies single wire CAN bus physical
layer and use compliant transceivers.
Read:
http://read.pudn.com/downloads164/doc/748056/standard/SAE%20J2411-2000%20Single%20Wire%20CAN%20Network%20for%20Vehicle%20Applications.pdf

It is very different then high speed physical layer specification.
According to the datasheet (and with extensive experiments) the high
speed CAN driver like (all) TI types can *not* be used as a single
wire type.

In that case you must use either the AU5790 or the TJA1054, TJA1055 and
compatible ones (search on Maxim, Onsemi, Infineon to name a few).
The keyword is fault tolerant. The TJA1054 and compatibles can really
have one "leg" being grounded while the other "leg" can still accept
CAN signals and translate them well.

In addition these signals are only low speed, meaning bitrates upto
a maximum of 125 Kbit/s. It is possible to get somewhat higher bitrates
but that can be only achieved in a laboratory but certainly not in a
harsh environment as the industry and automotive are.

Hope that these remarks clarify things.

Br,

Armand

The 2024 Embedded Online Conference