cancel
Showing results for 
Search instead for 
Did you mean: 

Why does CAN_TI0R_TXRQ fails to set?

DriesVR94
Associate II

Hello,

I am trying to communicate between two NUCLEO-F446ZE boards using the CAN protocol. To obtain this, I am basing myself on this video (https://www.youtube.com/watch?v=HYgYN0IEoNc&ab_channel=ASKEDISON%2CDOIT), although my code is a little different.

For some reason, I fail to transmit any data. I am using the HAL_CAN library and the STM32CubeIDE. When I run the debugger into the HAL_CAN_AddTxMessage() function, every step is executed properly, except for the last one: 

SET_BIT(hcan->Instance->sTxMailBox[transmitmailbox].TIR, CAN_TI0R_TXRQ);

According to the Reference Manual (RM0390 Rev 6), "In order to transmit a message, the application must select one empty transmit mailbox, set up the identifier, the data length code (DLC) and the data before requesting the transmission by setting the corresponding TXRQ bit in the CAN_TIxR register."

However, it fails to set this TXRQ bit. Why is this?

 

Any suggestions are welcome!

1 ACCEPTED SOLUTION

Accepted Solutions
DriesVR94
Associate II

Okay, I added two MCP2551 transceivers in between, and now it works. I am still curious why the video of the link in my original post made it work without transceivers, and I didn't. I have also seen and heard multiple sources working without transceivers when they only have two nodes and got it working.

So, how come sometimes it works without transceivers and sometimes it doesn't?

View solution in original post

1 REPLY 1
DriesVR94
Associate II

Okay, I added two MCP2551 transceivers in between, and now it works. I am still curious why the video of the link in my original post made it work without transceivers, and I didn't. I have also seen and heard multiple sources working without transceivers when they only have two nodes and got it working.

So, how come sometimes it works without transceivers and sometimes it doesn't?