C2000 eCAN bus-off condition

조회 수: 8 (최근 30일)
Donald
Donald 2019년 2월 4일
편집: ashwinee jadhao 2019년 4월 25일
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

채택된 답변

Donald
Donald 2019년 2월 6일
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
ashwinee jadhao
ashwinee jadhao 2019년 4월 25일
편집: ashwinee jadhao 2019년 4월 25일
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

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Venkatesh Chilapur
Venkatesh Chilapur 2019년 2월 5일
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 2019년 2월 5일
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 2019년 2월 6일
Hi,
Adding the below line of code should help!
HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_ABO;
Regards,
Venkatesh Chilapur

Donald
Donald 2019년 2월 6일

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by