|
Post by Admin on Apr 19, 2017 11:26:56 GMT
Just done a quick check and the msg1.id always contains the last received message's ID.
iLLD_CAN.ino (5.74 KB)
|
|
|
Post by Admin on Apr 19, 2017 11:41:18 GMT
BTW: the values returned by CAN1_ReceiveMessage() are:
IfxMultican_Status_noError = 0x00000000, IfxMultican_Status_notInitialised = 0x00000001, IfxMultican_Status_wrongParam = 0x00000002, IfxMultican_Status_wrongPin = 0x00000004, IfxMultican_Status_busHeavy = 0x00000008, IfxMultican_Status_busOff = 0x00000010, IfxMultican_Status_notSentBusy = 0x00000020, IfxMultican_Status_receiveEmpty = 0x00000040, IfxMultican_Status_messageLost = 0x00000080, IfxMultican_Status_newDataButOneLost = 0x00000100
If you get the message ID coming back as 608F it is likely that no CAN frame was received (0x40 returned from CAN1_ReceiveMessage()).
|
|
|
Post by Admin on Apr 20, 2017 11:04:56 GMT
Found a possible problem! By default, CAN1 goes to pin22 (CAN_TX) and pin23 (CAN_RX). This is to suit the Digilent Chipkit Comms Shield. However this is not compatible with the Arduino Due and the ToggleBit CAN shield which use Pin53 (TX) and DAC0 (RX) as the second CAN channel. We will add another CAN channel ("CAN3") to activate these pins in the next release. The Aurix has 4 CAN modules but at the moment, CAN2 is not used.
|
|
frank
New Member
Posts: 18
|
Post by frank on Apr 22, 2017 15:58:04 GMT
I don't use a CAN shield but connected CAN Transceivers to the corresponding ShieldBuddy pins. Instead of using an Arduino for testing/simulating the CAN communication I now used a USB CAN Interface (from Viewtool) for this. Now it works fine. At the moment I don't know extactly where the problem was. Thank you for the help!
|
|
jos
New Member
Posts: 1
|
Post by jos on Jul 12, 2017 19:42:10 GMT
Hello,
I'm trying to send CAN-messages from CAN0 to CAN1 with the "iLLD_CAN.ino"-sketch provided by Admin on April 19th. Unfortunately I don't receive any CAN-messages, but only return value 40 (receiveEmpty). Since I didn't alter the sketch, I think there's something wrong with my wiring. Can someone please assist me with guidance on how to wire CAN0 to CAN1 (which ShieldBuddy-pins should be connected to each other) and how should I add 120-ohm termination resistors to the wiring?
Thanks in advance!
|
|
|
Post by Christian on Jan 19, 2018 11:39:32 GMT
I have a question about sending Messages:
CAN0_SendMessage(0x101, 0x12345678, 0x9abc0000, 8);
Will look counterintuitive at the bus like: 78 56 34 12 00 00 BC 9A
Wouldnt it be easier to use a Byte array like "CanData[]" compared to the two 32-Bit Hex Numbers?
Is it possible to send more than 16 different messages? I am working on an automotive node stimulation which needs to simulate more messages.
Is there a source where I can find more details on how to use the CAN Interface in a more advanced way?
|
|
|
Post by Christian on Jan 19, 2018 12:36:41 GMT
Is there an example using CAN in eclipse?
|
|
|
Post by Admin on Jan 19, 2018 12:48:10 GMT
|
|
|
Post by Christian on Jan 22, 2018 9:40:11 GMT
Many thanks for your Help.
Your Arduino example uses:
"IfxMultican_Message msg1; IfxMultican_Status RxStatus; CANMessagePayloadType CANMessagePayload;"
or
"CANMessagePayload.dword[0]"
While this is partly self-explaining it is not in the CAN manual. Maybe there is even more?
|
|