2018-05-09 8:11 AM
Hello,
For every peripheral like SPI,I2C,USART , etc, ST's HAL gives 3 types of apis like poll, IT and DMA . Why this is not applicable to CAN bus ? I dont find an api like can_transmit_IT or receive_it in the latest stm32f4xx_hal_can.c
i am referring to
STM32Cube_FW_F4_V1.21.0\Drivers\STM32F4xx_HAL_Driver\Src
#stm32-disc #stm32f4-nucleo2018-05-09 10:42 PM
I use interrupts for everything, but Can_Tx
this is how to Tx Can, no interrupts needed.
if ((CAN->TSR & CAN_TSR_TME0) == CAN_TSR_TME0) // (1) { CAN->sTxMailBox[0].TDTR = canTxMsgLength[canTxMsgOUT]; // (2) length CAN->sTxMailBox[0].TDLR = canTxMsgBottomWord[canTxMsgOUT]; // (3) 4bytes CAN->sTxMailBox[0].TDHR = canTxMsgTopWord[canTxMsgOUT]; // (3) 4bytes CAN->sTxMailBox[0].TIR = ((uint32_t)canTxMsgID[canTxMsgOUT] << 21 | CAN_TI0R_TXRQ); // (4) // send it now if the line is idle
}