2020-01-14 05:55 AM
Dear
I use bxCAN new HAL library
I register notification by calling "HAL_CAN_ActivateNotification" and enable the following
CAN_IT_ERROR and CAN_IT_LAST_ERROR_CODE and CAN_IT_BUSOFF and CAN_IT_ERROR_PASSIVE and CAN_IT_ERROR_WARNING.
I'd implemented HAL_CAN_ErrorCallback this function
I'd try to do the following things
But there's no error notification happening ,
Is there anyone know how to produce CAN ERROR
Thanks
2020-01-14 06:41 AM
I have not tested it, but atleast datasheet of my stm32f446re6 says
The LEC[2:0] bits can be set to value 0b111 by software. They are updated by hardware to indicate the current communication status.
LEC bits are 4-7 from CAN_ESR register in my mcu.
CAN_ESR |= (111 << 4);
For you the bit positions might vary, but something like that should in my opinion trigger the interrupt.
2020-01-14 07:29 AM
Dear JoinS
I using HAL_CAN_ActivateNotification (hcan, CAN_IT_LAST_ERROR_CODE) to set the LEC bit in IER register
May i know how you trigger CAN ERROR?