infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 6 of 6

Thread: Automotive CAN bus interface using an XMC4500 - Getting started

  1. #1
    New Member New Member phab is on a distinguished road
    Join Date
    Oct 2017
    Posts
    22
    Points
    215

    Automotive CAN bus interface using an XMC4500 - Getting started

    Hi all,

    I am developing an electronic module incorporating an XMC4500 which needs to communicate five values onto the CAN bus of an automobile. From a firmware viewpoint I have zero experience in this field and I would really appreciate any help on how to go about this.

    Thank you very much

    PHAB

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    574
    Hi,

    You can start looking to the CAN_NODE APP and examples
    Click image for larger version

Name:	can_examples.png
Views:	4
Size:	29.1 KB
ID:	3913

    Regards,
    Jesus
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    New Member New Member phab is on a distinguished road
    Join Date
    Oct 2017
    Posts
    22
    Points
    215
    Thanks Jesus (sorry for the delay in replying, didn't get a notification for some reason).

    Would you be able to confirm if the following are possible with the XMC4500 please...

    1) 2 x physical CAN buses operating simultaneously.
    2) Different baud rates on each CAN bus
    3) Pass received data from CAN 1 to CAN 2 via the gateway (with different baud rates) but also receive the data from CAN 1 (either directly from CAN 1 or indirectly from CAN 2)


    Thank you very much

    Aaron
    Last edited by phab; Apr 15th, 2019 at 09:25 AM.

  4. #4
    Beginner Beginner
    Infineon Employee
    Infineon Employee
    SunYajun is on a distinguished road
    Join Date
    Nov 2014
    Posts
    9
    Points
    82.03125
    yes, you can use Gateway feature to forward frame without any modification or CPU load or controlled per SW, e.g. add instruction code for transmit trigger, etc. detailed info see please an appnote
    https://www.infineon.com/dgdl/Infine...4ed91d6be32110
    https://www.infineon.com/dgdl/Infine...4ed926583230a4

  5. #5
    New Member New Member phab is on a distinguished road
    Join Date
    Oct 2017
    Posts
    22
    Points
    215
    Thank you very much.

  6. #6
    New Member New Member phab is on a distinguished road
    Join Date
    Oct 2017
    Posts
    22
    Points
    215
    For anyone looking to implement basic CAN, here are the steps for building and transmitting two CAN messages each containing 8 bytes of data (without error handling)…


    1) ADD the 'CAN_NODE' App to your project using DAVE's 'Add New APP' feature


    2) Configure the APP. In this example I have specified 2 message objects with a transmission rate of 500kbps. The messages have CAN ID's of 0x130 and 0x131. Each message object (MO) contains 8 data bytes to be transmitted (64 bits of data).

    Click image for larger version

Name:	General Settings.jpg
Views:	0
Size:	28.3 KB
ID:	4003

    Click image for larger version

Name:	MO Settings.jpg
Views:	0
Size:	51.6 KB
ID:	4004


    3) To transmit a message object containing your data, you need to write your 64 bits of data into the two 32 bit registers (Data_H and Data_L) of a message object before initiating a CAN message transmission.
    It is entirely up to you and the receiver what you put in the 8 bytes. For example two of the bytes might contain 16 independent flags, a 32 bit value spread over 4 consecutive bytes and two 8 bit values in two independent bytes.
    The data format is normally specified in a '.dbc' data base file. There are many free viewers for such files enabling you to agree the format with the receiver.


    CAN_NODE_STATUS_t mo_tranmit_status;

    uint8_t CAN_Data[9];

    // Fill the 'CAN_Data' array with 8 bytes of your data (for message 1)
    // Your own code here

    // Load the 'CAN_Data' array into message object 1 (Data_H and Data_L)
    CAN_NODE_MO_UpdateData(CAN_NODE_0.lmobj_ptr[0],CAN_Data);


    // Fill the 'CAN_Data' array with 8 bytes of your data (for message 2)
    // Your own code here

    // Load the 'CAN_Data' array into message object 2 (Data_H and Data_L)
    CAN_NODE_MO_UpdateData(CAN_NODE_0.lmobj_ptr[1],CAN_Data);


    //Transmit message object 1
    mo_tranmit_status = CAN_NODE_MO_Transmit(CAN_NODE_0.lmobj_ptr[0]);

    //Transmit message object 2
    mo_tranmit_status = CAN_NODE_MO_Transmit(CAN_NODE_0.lmobj_ptr[1]);


    4) The Data_H and Data_L contents can be viewed within the DAVE Debug perspective. Useful for ensuring you have loaded them correctly.

    5) There are very low cost CAN analyser modules which will enable you to view the actual CAN message contents the receiver will see. Useful for ensuring you are sending the bytes in the correct order and multi-byte values are sent in the correct order. e.g. Little endian (Intel format) or big endian(Motorola format).

    I hope this helps

    PHAB

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.