2024-03-19 02:48 PM
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!
Solved! Go to Solution.
2024-03-20 03:12 AM
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?
2024-03-20 03:12 AM
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?