I am having Unhandled interrupts:
*** UNHANDLED INTERRUPT ***
void Start_CAN(uint_32 RxIdentifier){ uint_32 result; _bsp_flexcan_io_init(0); CAN_LBK_OFF;//Hardware specific RSE0_ON; //Hardware specific result = FLEXCAN_Softreset ( CAN_DEVICE); result = FLEXCAN_Initialize ( CAN_DEVICE, 0, 0, 250, FLEXCAN_IPBUS_CLK); result = FLEXCAN_Select_mode( CAN_DEVICE, FLEXCAN_NORMAL_MODE); result = FLEXCAN_Set_global_stdmask (CAN_DEVICE, 0x222 ); result = FLEXCAN_Error_int_enable(CAN_DEVICE); result = FLEXCAN_Install_isr_err_int( CAN_DEVICE, (pointer)FlexCAN_ISR ); result = FLEXCAN_Install_isr_boff_int( CAN_DEVICE, (pointer)FlexCAN_ISR ); FLEXCAN_Initialize_mailbox( CAN_DEVICE, 4, 0x21/*Direccion Destino*/, 8, FLEXCAN_TX, FLEXCAN_STANDARD, FLEXCAN_ENABLE); FLEXCAN_Activate_mailbox(CAN_DEVICE, 4, FLEXCAN_TX_MSG_BUFFER_NOT_ACTIVE); FLEXCAN_Install_isr( CAN_DEVICE, 4, (pointer)FlexCAN_ISR ); FLEXCAN_Set_global_stdmask(CAN_DEVICE, 0xFFFFFFFF); result = FLEXCAN_Initialize_mailbox(CAN_DEVICE, 0, RxIdentifier,8, FLEXCAN_RX, FLEXCAN_STANDARD, FLEXCAN_ENABLE); result = FLEXCAN_Activate_mailbox(CAN_DEVICE, 0, FLEXCAN_RX_MSG_BUFFER_EMPTY); result = FLEXCAN_Install_isr( CAN_DEVICE, 0, (pointer)FlexCAN_ISR ); result = FLEXCAN_Initialize_mailbox(CAN_DEVICE, 1, BROADCAST,8, FLEXCAN_RX, FLEXCAN_STANDARD, FLEXCAN_ENABLE); result = FLEXCAN_Activate_mailbox(CAN_DEVICE, 1, FLEXCAN_RX_MSG_BUFFER_EMPTY); result = FLEXCAN_Install_isr( CAN_DEVICE, 1, (pointer)FlexCAN_ISR );} /* EndBody */
If I am right, this corresponds to the MCF5225_INT_FLEXCAN_BUF5 interrupt, I am not installing buffer 5 interrupt, therefore I dont see where the problem is. This is my initialization code, what could be causing the problem?
Thanks
Well this sounds scary...
I can see that another interrupt was interrupted. What are you doing in the CAN ISR? And what ISR was interrupted?
Are you sure you don't mess somehow with CAN registers anywhere? Perhaps some memory access violation?
Can you also check whether you receive message into any of your activated mailboxes when this happens? You can use TAD or CW register dump for that.
PetrM
Yes, I am having a trouble finding the source of the problem. Let me ask you the following thing:
If I have a couple (or more Transmit MailBoxes) , Can they be used by different tasks without the need of mutexes?
This maybe the issue.
You have to use mutexes (or lwsemaphores) in that case, because those tasks together could access the CAN registers in inappropriate way (sequence).
Maybe you should introduce one CAN communication task and consider messages/events/etc when using this task by other tasks.
PetrM