cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 CAN communication

Sameer Wagh
Associate II
Posted on January 17, 2018 at 13:00

Hello,

   i am using STM32F429IIT controller.I am trying communicate between CAN1 and CAN2 but yet not success.can you please provide any reference code for the CAN communication.

Thanks

#stm32f429-can-communication
10 REPLIES 10
Posted on January 20, 2018 at 06:54

You should get an example going first with a CAN-dongle.

I used the CanDo unit, made it transmit every 10mS and worked on my receiver first.

Using HAL drivers and examples, sets 'your' code aside from the 'processor' code.

It is the best methodology if you want transportable code.

but if you want to use the direct method, this will only work with BxCan hardware, and not recommended.

here is a snippet from transmit mailbox 2..

if ((CAN->TSR & CAN_TSR_TME2) == CAN_TSR_TME2) // (1) 
 CAN->sTxMailBox[2].TDTR = canTxMsgLength[canTxMsgOUT]; // (2) length
 CAN->sTxMailBox[2].TDLR = canTxMsgBottomWord[canTxMsgOUT]; // (3) 4bytes
 CAN->sTxMailBox[2].TDHR = canTxMsgTopWord[canTxMsgOUT]; // (3) 4bytes
 CAN->sTxMailBox[2].TIR = ((uint32_t) canTxMsgID[canTxMsgOUT] << 21 | CAN_TI2R_TXRQ); // (4) send it now if the line is idle
�?�?�?�?�?�?�?�?�?�?�?