F446RE and CAN2 in loopback mode
I'm working on a custom board with a F446RET6 and testing through some code bits. I've been able to successfully test that the board programs and functions with a led-blink style program. My problem is that I'm attempting to use CAN2; I'm trying to test via loopback but I'm having issues getting any type of IRQ for a receive. I feel like its something basic I'm missing here but after reading through some other posts I'm either brain-dead or missing something.
- currently using the HSI clock but I wouldn't think that would matter for loopback testing (understand for the "real" thing would be best to use the HSE).
- RX GPIO is set to pull-up
- Verified (after looking at some old posts using an older version of Cube) that the CAN1 clock is being initialized
Also I understand that the "CAN2" device is really the "slave" to CAN1. I've got my slave start for the filter set to 14 to split everything half and half and just arbitrarily chose bank 15:
hcan2Filter.FilterActivation = ENABLE;
hcan2Filter.FilterIdHigh = 0x0000;
hcan2Filter.FilterIdLow = 0x0000;
hcan2Filter.FilterMaskIdHigh = 0x0000;
hcan2Filter.FilterMaskIdLow = 0x0000;
hcan2Filter.FilterMode = CAN_FILTERMODE_IDMASK;
hcan2Filter.FilterScale = CAN_FILTERSCALE_32BIT;
hcan2Filter.FilterFIFOAssignment = CAN_RX_FIFO1;
hcan2Filter.FilterBank = 15;
hcan2Filter.SlaveStartFilterBank = 14;
Also I have the FIFO1 message pending interrupt set up:
//enable CAN2 interrupt
if (HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO1_MSG_PENDING) != HAL_OK)
{
printf("CAN IRQ enable error\r\n");
Error_Handler();
}
The IRQ function for now just spits out the rx'd ID:
void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan)
{
if (HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO1, &RxHeader, RxData) != HAL_OK) //get can message
{
printf("CAN msg RX error\r\n");
Error_Handler();
} //handle any errors if not OK
printf("CAN Message Rx'd from ID %d\r\n", RxHeader.StdId);
return;
}
I've attached my IOC and main, can someone point out what's probably staring me in the face?
