2018-05-25 12:34 AM
Hello Everyone,
I,am having a issue with my can node.
The communication bw two can nodes built on STM32L4 works perfectly fine. But that's just for testing purpose. I don't intend to use it that way.
When I introduce it to an existing CAN bus, TX stops. Node is able to read the messages on the bus.
Please let me know what all things i can try or i might be missing.
Hope someone has already been down this road and can help me out..
CAN settings are as follow
hcan1.Instance = CAN1;
hcan1.Init.Prescaler = 6; hcan1.Init.Mode =CAN_MODE_NORMAL
; hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ; hcan1.Init.TimeSeg1 = CAN_BS1_13TQ; hcan1.Init.TimeSeg2 = CAN_BS2_2TQ; hcan1.Init.TimeTriggeredMode = DISABLE; hcan1.Init.AutoBusOff = DISABLE; hcan1.Init.AutoWakeUp = DISABLE; hcan1.Init.AutoRetransmission = ENABLE; hcan1.Init.ReceiveFifoLocked = DISABLE; hcan1.Init.TransmitFifoPriority = DISABLE;#can #can-interface #can-examples #problem-can2018-05-26 01:37 AM
Ok. Will try that out too.
Thought that if once it fails it wont try again ,so left it Enabled ;p
2018-05-26 11:21 AM
I tried with
AutoRetransmission = DISABLE;
AutoBusOff = ENABLE; (ABOM)
Still no luck.
However i have an input.
I,am using TJA1050 CAN Transreceiver
1) When monitoring CAN_TX pin on analyser without connecting the CAN H and CAN L pin to the bus.. the msg is transmitted and decoded.
2)
When monitoring CAN_TX pin on analyser with
connecting the CAN H and CAN L pin to the bus..I see activity on the the CAN TX pin but it is decoded as error by the analyser.
Hope this input helps you in guiding further.
2018-05-26 07:06 PM
is it possible that you have CanH and CanL swapped ?
or the MsgID is in conflict.
please be sure that no 2 devices can transmit the same MsgID.
2018-05-28 12:39 AM
is it possible that you have CanH and CanL swapped ?
As said before, this could be the case.
And for cables of more than a few centimeters length you NEED a proper termination on both bus ends.
I had such a case a few weeks ago, where I needed to 'hack' a termination resistor into the CAN cable near the device to get it working.
2018-05-28 02:16 AM
CAN H and CAN L are in Place.
Didn't knew the Length of wires could be an issue. will surely put on an termination register.
The RX was working so thought its not needed.
Thanks for the clarification.
2018-05-29 12:13 AM
this is confusing..
CanRx pin on the processor, must be pulled up, if there is no Transceiver chip.
Otherwise the Can-HAL will not Initialise
Are you connecting the OBD2 interface directly to the processor pins or with a CanBus transceiver ?
which vehicle are you connecting to ?
Did you know that some older OBD2 systems are not CanBus ?
On the OBD2 connector, which pins are you using ?
Pins 2 & 10
Pin 2 only
Pins 7 & 15
Pins 6 & 14
What speed are you running at ?
2018-05-29 01:16 AM
Adding termination didn't help either. :(
2018-05-29 01:40 AM
I,am using TJA1050 CAN Transreceiver
1) When monitoring CAN_TX pin on analyser without connecting the CAN H and CAN L pin to the bus.. the msg is transmitted and decoded.
2)
When monitoring CAN_TX pin on analyser with
connecting the CAN H and CAN L pin to the bus..I see activity on the the CAN TX pin but it is decoded as error by the analyser.
I would concentrate on this. Perhaps something wrong with the hardware ?
For prototypes, this would not be surprising.
2018-05-29 01:50 AM
Can u suggest an ideal schematic for the TJA1050 and OBD2.
there are Various Schematics available on internet and that's confusing.
The one mentioned in datasheet and application note doesn't require anything on the CAN-TX CAN-RX pins and even termination on CAN-H and CAN-l if you are getting introduced on an existing bus.
But that doesn't work at all. I have to pull down CAN-RX pin using 3.3K ohm resistor to get receive working.
Please guide if something is wrong and needs to be changed. A reference to an tested schematic would be really helpful.
2018-05-29 02:19 AM
For OBD2, I will bail out - I have no experience with it.
Being a software guy, I would have started with schematics suggested in the transceiver datasheet as well.