C2000 eCAN bus-off condition

7 visualizaciones (últimos 30 días)
Donald
Donald el 4 de Feb. de 2019
Editada: ashwinee jadhao el 25 de Abr. de 2019
I am using the TI C2000 Simulink support package in 2018b. Occasionally in my environment the eCAN block detects errors (I assume TEC=128) and goes bus-off. Is there a way I can reset/clear this error without cycling power?
Thanks,
Don

Respuesta aceptada

Donald
Donald el 6 de Feb. de 2019
I came up with something very similar, based on code in this post:
Declaration Code:
uint16_t ui16CANCTL;
Execution Code:
//Set the Auto-Bus-On bit in the CAN Control register to allow the CAN controller to recover from a bus-off event
//Read the high 16 bits of the 32bit register
ui16CANCTL = HWREGH(CANB_BASE + CAN_O_CTL);
//Write the high 16 bits OR'd with the ABO bit
HWREGH(CANB_BASE + CAN_O_CTL) = ui16CANCTL | CAN_CTL_ABO ;
//set timer to wait 0.1s before Bus-Off recovery sequence is started, $B71B0 should be 750000 clocks, which is 0.1s @ 7.5Mhz
HWREG(CANB_BASE + CAN_O_ABOTR) = 0x000B71B0;
//Do the same for the A CAN bus
ui16CANCTL = HWREGH(CANA_BASE + CAN_O_CTL);
HWREGH(CANA_BASE + CAN_O_CTL) = ui16CANCTL | CAN_CTL_ABO;
HWREG(CANA_BASE + CAN_O_ABOTR) = 0x000B71B0;
This code shows up near the end of "model_name".c in the folder "model_name" _ert_rtw in my setup.
I can now force a bus-off and it will recover.
Thanks for the help,
Don
  1 comentario
ashwinee jadhao
ashwinee jadhao el 25 de Abr. de 2019
Editada: ashwinee jadhao el 25 de Abr. de 2019
I have tried same solution but this is not solving my issue.
Here, file working on which is attached, please have a look
Thank you

Iniciar sesión para comentar.

Más respuestas (4)

Venkatesh Chilapur
Venkatesh Chilapur el 5 de Feb. de 2019
Hi,
We provide custom code blocks under simulink coder->custom code->System Initialize using which you may initialize the ABO bit in the CAN_CTL Register to enable the 'Auto-Bus-On' feature. This will help recover the CAN bus from a bus off state.
Regards,
Venkatesh Chilapur

Donald
Donald el 5 de Feb. de 2019
That sounds like what I want to do. I found the System Initialize block in the library, but I don't know the syntax of how to add setting ABO in CAN_CTL to this block.
Is there a tutorial or something you can point me to?
Thanks,
Don

Venkatesh Chilapur
Venkatesh Chilapur el 6 de Feb. de 2019
Hi,
Adding the below line of code should help!
HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_ABO;
Regards,
Venkatesh Chilapur

Donald
Donald el 6 de Feb. de 2019

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by