Freemaster CAN Driver issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Freemaster CAN Driver issue

966 次查看
sathish1
Contributor I

We are getting the following bus fault and hard fault when we are trying to execute the freemaster example application code for CAN communication. It fails exactly at these line in freemaster_can.c file.

/* configure CAN receiving (used by FlexCAN to setup MB) */
FMSTR_CAN_RINIT (FMSTR_CAN_CMDID_IDR0, FMSTR_CAN_CMDID_IDR1, \
 FMSTR_CAN_CMDID_IDR2, FMSTR_CAN_CMDID_IDR3);

sathish1_0-1669184037800.png

sathish1_1-1669184169181.png

Kindly help us on how to resolve this issue.

标记 (1)
0 项奖励
回复
3 回复数

933 次查看
iulian_stan
NXP Employee
NXP Employee

Hi @sathish1,

Are you using a custom demo application or a default example that comes with FreeMASTER Driver ?

If it's a custom demo could you please provide the source (a link) of the application.

Iulian

0 项奖励
回复

928 次查看
sathish1
Contributor I

We have downloaded the BCC SW Driver Package from Docstore BCC SW Driver Package for MC33771C and MC33772C(Lite Version) (nxp.com).

0 项奖励
回复

921 次查看
iulian_stan
NXP Employee
NXP Employee

Are you using processor expert to configure your board ?

If so, could you share your CAN configuration (pinMux, flexCAN) ?

That example is configured to work by default over UART. In order yo use CAN communication you would need to:
1. Configure CAN peripheral
2. Configure CAN pins
3. Call FLEXCAN_DRV_Init in the initDemo() function
4. Enable CAN interrupts (if you want to use FreeMASTER SHORT/LONG INTERRUPT mode)
5. Update freemaster_cfg.h to use CAN instead of UART

I commented the battery setup (I can not test a e2e scenario as I don't have a corresponding setup) and added the CAN configuration as per steps described above and was able to connect to the board from FreeMASTER GUI.

Note: by default SDK enables CAN abort mechanism, so I had to disable it manually:

/* Enter Freeze mode */
CAN0->MCR |= (CAN_MCR_FRZ_MASK | CAN_MCR_HALT_MASK);
CAN0->MCR &= ~CAN_MCR_MDIS_MASK;
while((CAN0->MCR & CAN_MCR_FRZACK_MASK ) == 0){}
/* Disable abort mechanism  MCR[AEN] = 0 */
CAN0->MCR &= ~CAN_MCR_AEN_MASK;
/* Enable the FlexCAN module */
CAN0->MCR &= ~(CAN_MCR_FRZ_MASK | CAN_MCR_HALT_MASK);

Hope it helps,
Iulian

0 项奖励
回复