cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Node not able to transmit when on an existing bus

Mohit Aggarwal
Associate II
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
28 REPLIES 28
stm322399
Senior
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
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
Lead
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
Lead
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.

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.

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. 

Posted on May 25, 2018 at 22:09

work on your receiver first, to get the baud rate correct, then work the transmitter.

ABOM must be enabled.

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

I have this disabled,

AutoRetransmission = DISABLE;

Posted on May 26, 2018 at 08:19

Sure I would try with ABOM enabled.

The receiving part is working perfectly fine. Have verified , the messages received on analyser and by the node are same. Let me know if there is still something else to be looked at receiver end.