Is there a simple and safe way to disable CANbus receive Interrupt or enable CANbus receive Interrupt
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-09-14 8:03 PM
Posted on September 15, 2016 at 05:03
Hi guys:
I just want to disable the Can receive Interrupt when processing the important datas and after then enable it again. should i config the can baud rate or other registersagain ,or just change the below part:just change this:NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
NVIC_Init(&NVIC_InitStructure);
Thanks
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-09-15 3:59 AM
Posted on September 15, 2016 at 12:59
Hi name_is_honglingjin,
You can use the dedicated Hal macro to Enable/disabe interrupt. For your case use it to enable/disable the used FIFO pending interrupt. For example , if uyou use FIFO1 , put this:/* Disable FIFO 1 message pending Interrupt */
__HAL_CAN_DISABLE_IT(hcan, CAN_IT_FMP1);
......
......
/* Disable FIFO 1 message pending Interrupt */
__HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP1);
-Hannibal-
