2016-08-30 07:45 AM
hi evry one
i working on CAN protocol with stm32f103rbt6.it working so good.now problem is here: when i reading mailboxs of FIFO0 ،all think is ok but i can not receive the message from FIFO1.please tell me how to do thisthank you2016-09-01 01:48 PM
Hi Hannibal.
ok. I wil test your solution.thank you for your feedback.2016-09-03 04:14 AM
Hi every body
i checked my code again. I use STM32 CUBE MX for generate code and KEIL for compile code and i configure CAN parameter by HAL driver. if you want to receive the message in Both FIFOs(0,1) you should type HAL_CAN_Receive_IT(&hcan,CAN_FIFO0);HAL_CAN_Receive_IT(&hcan,CAN_FIFO1);in your code.then when you configure filters you can define that which message pass from which filter and receive by which FIFO.for example :sFilterConfig.FilterNumber = 0;sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;sFilterConfig.FilterScale = CAN_FILTERSCALE_16BIT;sFilterConfig.FilterIdHigh = 0x0200; sFilterConfig.FilterIdLow = 0x220; sFilterConfig.FilterMaskIdHigh = 0xFFFF;sFilterConfig.FilterMaskIdLow = 0xFFFF;sFilterConfig.FilterFIFOAssignment = CAN_FIFO0; // message can receive in FIFO0sFilterConfig.FilterActivation = ENABLE;sFilterConfig.FilterNumber = 1;sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;sFilterConfig.FilterIdHigh = 0x250;//sFilterConfig.FilterIdLow = 0x00;sFilterConfig.FilterMaskIdHigh = 0xFFFF;sFilterConfig.FilterMaskIdLow = 0x0000;sFilterConfig.FilterFIFOAssignment = CAN_FIFO1; message can receive in FIFO1sFilterConfig.FilterActivation = ENABLE;in this case you can receive messages in FIFO0 and FIFO1.but this is very important that both FIFO(0,1) interrupt should be enable. you can add this line to end ofHAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONumber)
function like as this line:// if(FIFONumber == CAN_FIFO0)// {// /* Enable FIFO 0 message pending Interrupt */// __HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP0);// }// else// {// /* Enable FIFO 1 message pending Interrupt */// __HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP1);// } // } else { return HAL_BUSY; } /* Return function status */ __HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP0);// added by user __HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP1);// added by user return HAL_OK;i hope that my post can help you.