Skip to main content
Mohit Aggarwal
Associate II
May 25, 2018
Question

CAN Node not able to transmit when on an existing bus

  • May 25, 2018
  • 28 replies
  • 4830 views
Posted on May 25, 2018 at 09:34

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-can
This topic has been closed for replies.

28 replies

stm322399
Senior
May 25, 2018
Posted on May 25, 2018 at 10:00

Probably some clock mismatch.

Check generated bitrate, and also the balance between TimeSeg1 and TimeSeg2.

Mohit Aggarwal
Associate II
May 25, 2018
Posted on May 25, 2018 at 11:10

GONZALEZ.Laurent

Thanks for the response.

I intend to generate 500K bit rate and m able to decode that on an analyser when testing the node separately and with other stm32L4 node.

On the other bus (obd2 can bus ) too, i am able to receive the messages from ecu but not transmit.

I say so as my transmitted msgs are not visible on analyzer but on the other hand the messages sent by obd2 port is received on analyer and stm32L4 node too.

Please let me know if this still can be a clock issue.

and I exactly don't know much about

TimeSeg1 and TimeSeg2. i just copied the configuration from ''

http://www.bittiming.can-wiki.info/#STMicro

''

Have attached the picture of the same. Please suggest if any changes are required in this area.

0690X0000060BN0QAM.png

AvaTar
Senior III
May 25, 2018
Posted on May 25, 2018 at 11:22

Proper bus termination ?

CANH/CANL polarity correct ? Swapping both pins usually don't work.

Does any node go into Error-Passive or Bus-Off ?

T J
Senior III
May 25, 2018
Posted on May 25, 2018 at 11:29

you should have AutoBusOff enabled.

you should check the wires with a scope to see what is really going on.

AvaTar
Senior III
May 25, 2018
Posted on May 25, 2018 at 11:51

you should check the wires with a scope to see what is really going on.

If a CANbus analyzer shows no traffic you should definitely.

Mohit Aggarwal
Associate II
May 25, 2018
Posted on May 25, 2018 at 13:21

On CANbus analyser i can see the internal communication bw other nodes but not able to see the msg which is supposed to be transmitted by my node(STM32L4). Ican read the msges on my node too. so the traffic is there.It just tht the STM32L4 node is not transitting once on the bus.

I have read that CAN controller waits for the bus to get idle before transmitting.

So I,am suspecting that  something is being missed on those lines in configuration.

Please suggest or correct me if I,am thinking on wrong lines. 

T J
Senior III
May 26, 2018
Posted on May 26, 2018 at 08:32

I have this disabled,

AutoRetransmission = DISABLE;

Mohit Aggarwal
Associate II
May 26, 2018
Posted on May 26, 2018 at 08:37

Ok. Will try that out too.

Thought that if once it fails it wont try again ,so left it Enabled ;p 

T J
Senior III
May 29, 2018
Posted on May 29, 2018 at 09:13

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 ?

Mohit Aggarwal
Associate II
May 29, 2018
Posted on May 29, 2018 at 09:42

Hi TJ,

Have attached the block diagram of my setup.

The car if from FORD . and it has can bus.(have checked that with a scanner. and i am also able to read internal communication through the mentioned setup and the data makes sense too. ) 

0690X0000060KzVQAU.png

Hope this clarifies the setup

T J
Senior III
May 29, 2018
Posted on May 29, 2018 at 10:20

I have no direct experience with OBD either, but I can help with CanBus.

In the time Quanta, Try Seg1 at 14, Seg2 at 1

I haven't used a L4 processor but on the F0 and F7, you must pull CanRx up if you don't have the transceiver.

So that is confusing to start. It may be a bus state from the vehicle.

Tell me you have a proper scope and analyzer.

Tell me it is not a $6 Ebay analyser.

Do you have the FORD OBD msg list ?

What msg are you trying to send ?

just to clarify, you have a nucleo board,

one Canbus is for the FORD and the other Canbus is to another Nucleo board.

between the Nucleo boards, you can Receive and Transmit, are you using transceivers ?

The Ford Canbus, you are using a transceiver, you can Receive but not Transmit.

is that where we are ?

Mohit Aggarwal
Associate II
May 30, 2018
Posted on May 30, 2018 at 09:41

Marsh.Nick

meyer.frank

Hi,

Thank you for helping me throughout the issue.

Finally the issue is resolved.

Hacked in 0 ohm resistor on the CAN H and CAN L lines with 120 ohm(termination) resistor b/w them.