Skip to main content
Graduate
March 19, 2024
Solved

Why does CAN_TI0R_TXRQ fails to set?

  • March 19, 2024
  • 1 reply
  • 1016 views

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!

    This topic has been closed for replies.
    Best answer by DriesVR94

    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?

    1 reply

    DriesVR94AuthorAnswer
    Graduate
    March 20, 2024

    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?