Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Translation_Bot
Community Manager
Community Manager
Community Manager
100 likes received
{
canNodeConfig.nodeId = IfxMultican_NodeId_0;
canNodeConfig.rxPin = &IfxMultican_RXD0C_P12_0_IN;
canNodeConfig.rxPinMode = IfxPort_InputMode_pullUp;
canNodeConfig.txPin = &IfxMultican_TXD0_P12_1_OUT;
canNodeConfig.txPinMode = IfxPort_OutputMode_pushPull;
 
IfxMultican_Can_Node_init( &can0Node, &canNodeConfig).
}
Only changed RXD0C_P12_0 and TXD0_P12_1 in the routine, nothing else, is there something else that needs to be changed to enable CAN communication on these two pins?

0 Likes
1 Reply
wolfchip
Level 2
Level 2
First like received 10 replies posted 10 likes given

Your code seems to be correctly setting up the CAN node with the specified RX and TX pins. Here’s a brief explanation of what your code is doing:

  • canNodeConfig.nodeId = IfxMultican_NodeId_0; This line is setting the node ID for the CAN node.
  • canNodeConfig.rxPin = &IfxMultican_RXD0C_P12_0_IN; This line is setting the RX pin for the CAN node.
  • canNodeConfig.rxPinMode = IfxPort_InputMode_pullUp; This line is setting the RX pin mode.
  • canNodeConfig.txPin = &IfxMultican_TXD0_P12_1_OUT; This line is setting the TX pin for the CAN node.
  • canNodeConfig.txPinMode = IfxPort_OutputMode_pushPull; This line is setting the TX pin mode.
  • IfxMultican_Can_Node_init( &can0Node, &canNodeConfig); This line is initializing the CAN node with the specified configuration.

If you’ve only changed the RX and TX pins and nothing else, and assuming the rest of your code is correct, this should be sufficient to enable CAN communication on these two pins.

However, there are a few things you might want to check:

  1. Pin Compatibility: Make sure that the pins RXD0C_P12_0 and TXD0_P12_1 are compatible with CAN communication. Not all pins on a microcontroller are capable of supporting all types of communication protocols.

  2. Hardware Connections: Check your hardware connections. Make sure that the CAN transceiver is correctly connected to these pins and that the CAN bus is properly terminated.

  3. CAN Bus Settings: Check the settings of your CAN bus. The baud rate, sample point, and other settings on your CAN node must match the settings of the other nodes on the bus.

  4. Software Configuration: Check the rest of your software configuration. Make sure that the CAN node is correctly set up, that the CAN controller is enabled, and that the CAN interrupts (if used) are properly configured.

  5. Error Handling: Implement error handling in your code. Check the return value of IfxMultican_Can_Node_init() and other functions to make sure they are completing successfully.

Good luck with your project! 

 
0 Likes