This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TINA/Spice/TMS570LS1227: Can communication

Part Number: TMS570LS1227
Other Parts Discussed in Thread: TINA-TI, , HALCOGEN

Tool/software: TINA-TI or Spice Models

Hi,

we are developing code on tms570ls1227 for taking data from 8 sensors connected on can bus with fixed time gap one by one. i imported can code into ccs.

in sys_main.c , in main function i called canGetdata() after initialization one time . i initialized only can1 for receiving, and message box 1. for 8 sensors how should i configure to receive data  above  requirement .

Is interrupt mode necessary. because i have to collect with fixed time gap one by one. only one canreg1, can1 is sufficient. please guide me for this requirement.

is canmessagenotification a handler function?

How to set time gap (what is the function for delay) for each cangetData() calling function.

Thanks and regards,

K Subrahmaniam

  • Hello,

    I think you should use interrupt for receiving data.

    In case message is received and interrupts for this message box are enabled then interrupt will be handled by can interrupt handler (it is in can.c file) . canMessageNotification will be called by interrupt handler and there you can call canGetData.

    With RTI module you can generate interrupt on fixed time interval to initiate CAN transfer.

    To request data from another CAN node you can transmit Remote Frame (Section 27.8.10 of device TRM) or you can send message to another node which can be used from another node as signal to send data.

    Best regards,

    Miro

  • Hi,

    Thank you for immediate reply, what is the api to maintain delay and api for sending signal over can bus. can you give me some example or mention apis.

    Thanks and regards,

    K subrahmaniam

  • Hello,

    You can configure RTI module using HALCoGen to generate interrupt on fixed interval of time. More on RTI module can be found in device TRM ( www.ti.com/.../spnu515c.pdf ) The APIs for RTI module are rti.c.

    APIs for CAN module are in can.c

    Best regards,

    Miro

  • Part Number: TMS570LS1227

    Tool/software: TINA-TI or Spice Models

    Hi,

    we are using tms570ls1227 mcu . we generate helcogen project. our aim is to connect eight sensor ecus are connected to my mc and receive sensor data for 2ms or somthing. i set rti for that .

    in code canREG1, canREG2 are the nodes. then how can i configure 8 ecus .

    can i use can1 only .

    i want send rtr and getting data.

    where can i metion id.      please guide me with one example. ihave gone through all links . i cant find multiple sensors type . nodes and ids are confusing . please guide me.

    i wrote as below to get data from different ecus(nodes). is it correct .

    canSendRemoteFrame(canREG1, canMESSAGE_BOX1);
         rtiStartCounter(rtiCOUNTER_BLOCK0);
         canSendRemoteFrame(canREG1, canMESSAGE_BOX2);
         rtiStartCounter(rtiCOUNTER_BLOCK0);
         canSendRemoteFrame(canREG1, canMESSAGE_BOX3);
         rtiStartCounter(rtiCOUNTER_BLOCK0);
         canSendRemoteFrame(canREG1, canMESSAGE_BOX4);
         rtiStartCounter(rtiCOUNTER_BLOCK0);

    thanks and regards,

    K Subrahmaniam

  • Hello,

    RTI module can generate interrupt on a fixed interval of time. In HALCoGen you can find example of how to use RTI for generating interrupt. Example is named example_rtiBlinky.c . Description how to configure MCU for this example is in Help-->Help Topics-->Examples.

    Then in rtiNotification (function that is called by CAN interrupt handler) you could send Remote Frame.

    CAN module could be configured to receive CAN messages using interrupts ( example how to configure CAN in interrupt mode can be found under HALCoGen examples folder in file "example_canIntCommunication.c"  and description is in Help-->Help Topics-->Examples. ).

    You can set one message box to send remote frames and another box for receiving messages. Yo can set more than one message box for receiving as well. CAN module could be set to receive all messages by one message box or 8 message boxes could be set to receive messages for 8 different sensors using filtering. 

    Here is one very good explanation on mask filtering:

    I hope this helps.

    Best regards,
    Miro

  • Thank you Miro,

    I am confusing about msgid to transmit remote frame . Where can I mention msgid . And in receiving messages how can I identify msgid to receive data from 8 sensors one by one. Please guide me .

    Thanks and regards,

    K sibrahmanyam

  • Part Number: TMS570LS1227

    Tool/software: TINA-TI or Spice Models

    Hi,

    we are using tms570ls1227. in helcogen project and can communication, i want to receive data from different 8 sensors.  

    while sending remote frame, where can i mention message id,  any example program to take data from different sensors with fixed timegap. 

    thanks and regards,

    K Subrahmaniam

  • Hello,

    ID is set from CANn Msg Tabs HALCoGen. For CAN1: CAN1-->CAN Msg1-8 tab. Then in Message box configuration ID can be set.

    canGetID returns message box ID.

    Best regards,
    Miro