Mayank Prabhakar
Mayank Prabhakar

Reputation: 133

Unable to reset the can error using CAN bus error recovery sequence. As when the can bus is not connected to other node

Subject: Unable to reset the can error using CAN bus error recovery sequence. As when the can bus is not connected to other node .

Description: We are using infineon XE164 micro-controller and keil uvsion4 for compile the code.


BACKGROUND AND THE HARDWARE SETUP

Our product setup is as below:

  1. We are using XE164 micro-controller to control peripherals . In peripherals it basically control the servo motor , stepper motor , lcd and keypad.

  2. We want to transmit data from infenion XE164 node to PIC18f2480 node.


PROBLEM

  1. There is no issue to transmit and receive data from both node on can bus.

  2. When bus is not connected and data is transmitted by XE164 board our can bus goes in error state.what is recovery sequence to change the can bus mode in error state to idle state.

  3. How to avoid this without hardware reset of micro controller.

Upvotes: 1

Views: 3148

Answers (1)

Swanand
Swanand

Reputation: 4115

In CAN protocol, ACK is a must!

If there is no other node on the bus, CAN Transmission will not work and it's a correct behaviour that it goes in error state.

Only way to get rid of that error state is re-initializing your CAN module (like calling CANInit() again), because even after error recovery sequence, CAN controller retries to transmit the data and again gets stuck into Error state and this will go on... Re-initialization will stop its attempts and CAN module will be in normal state.

EDIT after comment from OP:

If you want to poll whether there is a device on bus or not, you can set a Timer interrupt of say X msec and in Timer ISR: 1. Initialize CAN 2. Send a CAN Message 3. If no error interrupt is generated and message is successfully transmitted, stop timer otherwise keep it going.

You can also try different baud rates too.

Upvotes: 2

Related Questions