2018-06-01 09:35 PM
Set can model Init setting in STM32CubeBx,and generate Code in keil5 project ,and then set Filter of can1 and can2 ,two of can 's transmation is OK,but receive is not;
Code as this:
CAN_FilterConfTypeDef FilterConfig;
CanTxMsgTypeDef TxMsg;CanRxMsgTypeDef RxMsg;FilterConfig.FilterIdHigh = 0;
FilterConfig.FilterIdLow = 0; FilterConfig.FilterMaskIdHigh = 0; FilterConfig.FilterMode =0; FilterConfig.FilterNumber=0; FilterConfig.FilterScale= CAN_FILTERSCALE_32BIT; FilterConfig.FilterFIFOAssignment= CAN_FILTER_FIFO0; FilterConfig.BankNumber= 0U; FilterConfig.FilterActivation= ENABLE; HAL_CAN_ConfigFilter(&hcan1, &FilterConfig); FilterConfig.BankNumber= 14U; FilterConfig.FilterFIFOAssignment= CAN_FILTER_FIFO1; HAL_CAN_ConfigFilter(&hcan2, &FilterConfig); for(;i<8;i++) TxMsg.Data[i] = i+1; TxMsg.DLC = 8; TxMsg.IDE = CAN_ID_EXT; TxMsg.ExtId = 0x02222222; TxMsg.RTR= CAN_RTR_DATA; hcan2.pTxMsg = &TxMsg; hcan2.pRx1Msg = &RxMsg;void main
{
HAL_CAN_Receive(&hcan1, CAN_FIFO0,10);
HAL_CAN_Receive(&hcan2, CAN_FIFO1,10);
}
register RF0R.FMP1 and RF1R.FMP1 when receive would be more than 0
and why?
thanks !!!
#stm32f105rb-can