I am currently using the STM32F1Cube drivers on a STM32F107VC MCU (STM3210C-EVAL board) and I discovered a bug in CAN drivers.
The problem is in the "stm32f1xx_hal_can.h file on line 379.
#define CAN_FLAG_TXOK2 ((uint32_t)((TSR_REGISTER_INDEX << 8U) | CAN_TSR_RQCP0_BIT_POSITION)) /*!< Transmission OK MailBox2 flag */
When you send a CAN frame, the IRQ (HAL_CAN_IRQHandler) always call CAN_Transmit_IT/HAL_CAN_TxCpltCallback even if the transmission failed. Your never have "HAL_CAN_ERROR_TXFAIL" as error code.
If you have a CAN configuration with no automatic retransmission without other device connected on bus CAN and you try to send a CAN frame you never know than you have a transmission error.
This must be
#define CAN_FLAG_TXOK2 ((uint32_t)((TSR_REGISTER_INDEX << 8U) | CAN_TSR_TXOK2_BIT_POSITION)) /*!< Transmission OK MailBox2 flag */
I don' know if it's the good place to report this bug.