Attachments are accessible only for community members.
Jan 14, 2019
09:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 14, 2019
09:26 AM
Hi all,
I'm trying to use the XMC4700 Relax Kit to send transmissions onto the external CANbus via the X2 connector and can't figure out how to properly configure and send this data. The only non-loopback example I can find is in the XMCLibs examples for the XMC4500:
I've tried modifying the example for the XMC4700 Relax Kit including:
When compiled and loaded I see the LED blink as expected but I see no data on the Relax kit CANbus using an oscilloscope. I have several Relax Kits available to me and it does this on multiple boards so it doesn't appear to be an isolated hardware issue. Here's my latest code modified from the CAN_TRANSMITTER example.
I haven't found a good example for DAVE applications using CANbus transmissions (non-loopback) either. Overall, anyone have any suggestions? Been really stumped and feel like I'm missing something obvious!
I'm trying to use the XMC4700 Relax Kit to send transmissions onto the external CANbus via the X2 connector and can't figure out how to properly configure and send this data. The only non-loopback example I can find is in the XMCLibs examples for the XMC4500:
XMCLib\examples\XMC4500_series\CAN\CAN_TRANSMITTER
I've tried modifying the example for the XMC4700 Relax Kit including:
- Changing LED1 to P5_9
- Changing TXD to P1_12
- Changing RXD to P1_13
- Using CAN_node1 (P1_12 and P1_13 are CAN_node1 pins ALT2)
- Use XMC_CAN_CANCLKSRC_FOHP (also tried XMC_CAN_CANCLKSRC_FPERI) in XMC_CAN_Init due to Multican+ in XMC4700
When compiled and loaded I see the LED blink as expected but I see no data on the Relax kit CANbus using an oscilloscope. I have several Relax Kits available to me and it does this on multiple boards so it doesn't appear to be an isolated hardware issue. Here's my latest code modified from the CAN_TRANSMITTER example.
I haven't found a good example for DAVE applications using CANbus transmissions (non-loopback) either. Overall, anyone have any suggestions? Been really stumped and feel like I'm missing something obvious!
2 Replies
Attachments are accessible only for community members.
Jan 15, 2019
07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 15, 2019
07:12 AM
Jan 22, 2019
01:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 22, 2019
01:22 PM
@jferreira thanks for the response! Your example code above worked! Here are some of the larger items I realized were key to getting good code.
CANbus frequency
I originally used 120MHz, your code uses 144MHz. I presume this wasn't the main issue as it likely only affect bit timing. Any elaboration would be helpful.
Arbitration Mode
Your code uses "XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2" whereas the original example code in XMClib uses "XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_1", why is that?
CAN Node Receive Bit Set
Your XMC4700 code uses "CAN_NODE1_RXD_P1_13" whereas the XMClib example uses "XMC_CAN_NODE_RECEIVE_INPUT_RXDCA". Unlikely to be the cause of the no transmissions but I'd love to know what causes the difference.
XMC GPIO Setmode
Whoa! This is the most unexpected difference. The following line in your XMC4700 code caught me off-guard:
XMC_GPIO_SetMode(CAN_TXD, XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P1_12_AF_CAN_N1_TXD);
I have NEVER seen an example OR "P1_12_AF_CAN_N1_TXD" with the push/pull setting. Where is this documented. I can't find it explained anywhere. I think this was likely what was causing my problem.
Thanks again for the help and I'd love to have a little direction to help answer these questions. Obviously will share what I learn so it helps others.
CANbus frequency
I originally used 120MHz, your code uses 144MHz. I presume this wasn't the main issue as it likely only affect bit timing. Any elaboration would be helpful.
Arbitration Mode
Your code uses "XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2" whereas the original example code in XMClib uses "XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_1", why is that?
CAN Node Receive Bit Set
Your XMC4700 code uses "CAN_NODE1_RXD_P1_13" whereas the XMClib example uses "XMC_CAN_NODE_RECEIVE_INPUT_RXDCA". Unlikely to be the cause of the no transmissions but I'd love to know what causes the difference.
XMC GPIO Setmode
Whoa! This is the most unexpected difference. The following line in your XMC4700 code caught me off-guard:
XMC_GPIO_SetMode(CAN_TXD, XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P1_12_AF_CAN_N1_TXD);
I have NEVER seen an example OR "P1_12_AF_CAN_N1_TXD" with the push/pull setting. Where is this documented. I can't find it explained anywhere. I think this was likely what was causing my problem.
Thanks again for the help and I'd love to have a little direction to help answer these questions. Obviously will share what I learn so it helps others.