CAN receive doesn't work
Hello everyone,
I'm currently doing some experiments with CAN communication with the STM32F302RB Nucleo board. The board is connected to a wcmcu-230 CAN transceiver which is connected to a Raspberry pi with a CAN header connected to it. The bus is terminated with a 120Ohm resistor on both sides.
I generated the HAL with CubeMX. RX1 interrupt is enabled and the pins are left as default:

The bus is running on 125kbits/s and is configured as follows:

I followed the instructions from this tutorial:
I use the following code:
CAN_RxHeaderTypeDef rxHeader; //CAN Bus Transmit Header
CAN_TxHeaderTypeDef txHeader; //CAN Bus Receive Header
uint8_t canRX[8] = {0,0,0,0,0,0,0,0}; //CAN Bus Receive Buffer
CAN_FilterTypeDef canfil; //CAN Bus Filter
uint32_t canMailbox; //CAN Bus Mail box variable
//in main:
canfil.FilterBank = 0;
canfil.FilterMode = CAN_FILTERMODE_IDMASK;
canfil.FilterFIFOAssignment = CAN_RX_FIFO0;
canfil.FilterIdHigh = 0;
canfil.FilterIdLow = 0;
canfil.FilterMaskIdHigh = 0;
canfil.FilterMaskIdLow = 0;
canfil.FilterScale = CAN_FILTERSCALE_32BIT;
canfil.FilterActivation = ENABLE;
canfil.SlaveStartFilterBank = 14;
txHeader.DLC = 8; // Number of bites to be transmitted max- 8
txHeader.IDE = CAN_ID_STD;
txHeader.RTR = CAN_RTR_DATA;
txHeader.StdId = 0x030;
txHeader.ExtId = 0x02;
txHeader.TransmitGlobalTime = DISABLE;
HAL_StatusTypeDef res = HAL_CAN_ConfigFilter(&hcan,&canfil); //Initialize CAN Filter
res = HAL_CAN_ActivateNotification(&hcan,CAN_IT_RX_FIFO0_MSG_PENDING);// Initialize CAN Bus Rx Interrupt
res = HAL_CAN_Start(&hcan); //Initialize CAN Bus
uint8_t csend[] = {'H','E','L','L','O'}; // Tx Buffer
res = HAL_CAN_AddTxMessage(&hcan,&txHeader,csend,&canMailbox); // Send Message
//At the end of main.c:
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan1)
{
HAL_CAN_GetRxMessage(hcan1, CAN_RX_FIFO0, &rxHeader, canRX); //Receive CAN bus message to canRX buffer
HAL_GPIO_TogglePin(GPIOb, GPIO_PIN_13);// toggle LED
}I receive the HELLO message on the pi, so I conclude that the hardware setup is properly done. However, when I send a message from the Pi, it is never received on the stm side. I played around but the interrupt was never received. I added a second Pi and there I could actually see the message. So I'm sure the message is sent from the Pi.
Can someone please help me with this issue? I'm quite lost in this. Thanks in advance!

