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.

LAUNCHXL-F28379D: LaunchXL-F28379D

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Tool/software:

Hello Guys, 

I am working on a Launchxl - F28379D board on which I want to create a CAN BUS over which i will connect multiple F28379D boards. I basically want to receive some ANALOG data from the ADCIN pins and I want to route this received data over the CAN Bus through CAN pins present on the board. I need help regarding how this problem could be tackled and how do we make a code and tackle the problem such that i could connect the ADC pins and CAN pins such that I can initialize all the boards to receive and transmit the data from while also connecting the ADC and CAN pins. 

I need help regarding as this is my first time using Launchxl F28379D. 

Thanks and Regards

  • Hi Chirag,

    Best way is to start with the basic CAN and ADC examples in C2000Ware.  You can start with adc_ex2_soc_epwm to check out the AC operation and observe how the ADC results are generated.  Note that ADC result data comes out at 16-bit wide.  Also check out and run examples can_ex4_simple_transmit and can_ex5_simple_receive,  This will give you directions on how to connect to the transceivers and into the CAN bus.  Note that CAN frame has a width of 8 bytes maximum so you need to organize the 16-bit wide ADC data to fit in the CAN byte format.

    Hope the C2000Ware examples will give you a good start.

    Regards,

    Joseph

  • Hey Joseph, 

    As per these examples I have already worked on them. I am familiar with the CAN Communication with Launchpad. My doubt here is how do i manage the connection between the ADC input and transmitting that input over the bus through CAN. 

    i.e. how do i rearrange the 16 bit ADC data to support CAN transmission. I need help with the code part and also the configuration of the board if necessary.

    Regards 

  • Hi Chirag,

    - The results of the ADC channel conversions will be available in the AdcResults register

    - AdcResults register is 16-bit wide.  Write this data to the TX data register in the CAN test.  For instance, result of mid-code conversion for 12-bit mode is 0x7FF.  In the CN example, TX data is written to buffer txMsgData.  You can write this ADC result in the buffer as follows:

              txMsgData[0] = 0x07;

              txMsgData[1] = 0xFF;

              txMsgData[2] = high byte from other ADC result

              txMsgData[3] = low byte from other ADC result

             :

             :

    - For CAN connection, connect CAN_RX and CAN_TX to the transceiver in the launchpad.  Ensure that the transceiver switch position for the TX/RX pin corresponds to the correct GPIO #s in the program. Output of the transceiver are two lines called CANL and CANH.  Ensure that the 120 ohms load resistor is connected between CANL and CANH.  Follow the same CAN connection in the other launchpad.  To connect several launchpads together, all CANL lines should be connected together and all CANH lines from the launchpads should be connected together.  See the introduction section of this app note on how the different CAN nodes should be connected.  In your case, the different nodes are the individual launchpads.

    Regards,

    Joseph

  • Hey Joseph, 

    Thanks for your support. 

    Is there any project which i can use to just paste my code and build it? I have a lot of problems in building a new project as I am a very new person to code composer studio, or else is there a way to remove errors i.e. a tutorial of some kind? I can take support from Matlab i.e i can build my code using MATLAB but I do need to learn how to build a new project. 

    Also if there is a full code according to my task that would be really helpful.

    Regards

  • Hi Chirag,

    The examples provided in C2000Ware demonstrate basic operation per module, like ADC, CAN, SPI, DAC, LIN...etc.  The examples are designed to be simple and easy to follow.  Examples are also supported by SysConfig, which is a GUI-based code generation tool and this gives users the flexibility of reconfiguring the setup, minimizing the effort of manual code generation.

    We do not have specific project examples that combine ADC and CAN.  Best way to tackle your project is expand one of the ADC examples, configure the ADC channels that you plan to use and organize the converted data.  Same thing with CAN, you probably need to get familiar with the basic transmit/receive examples to get a feel on how the configuration works.  You can then combine the routines you developed with ADC and CAN and start transmitting converted ADC data to CAN bus.

    Another option would be to use Mathworks/Simulink.  F28379D is fully supported in the UI and this allows code generation through GUIs as well.  Check with Mathworks or post in their forums too for ADC and CAN code generation support.

    Best regards,

    Joseph

  • Hello Joseph, 

    Thanks for the suggestion. 

    Also I wanted to configure multiple ti boards for can communication such that all the boards can communicate data i.e transmit and receive data amongst the CAN BUS. I want each board to be able to send data and each board to make it able to receive data to a central motherboard. Also I want an acknowledgement after each successful transmission i.e. I want the receiving motherboard to send an acknowledgement bit after every transmission. 

    What do i need to add in the code or any block that i can add in MATLAB such that the get the acknowledgement. 

    Regards

  • Hi Chirag,

    Check this link for MathWorks and see if you can get some examples in Matlab: MathWorks Account Sign In

    Regards,

    Joseph

  • Hey Joseph, 

    How do I access DACVAL and route its data to CAN regs for transmission?

    Regards

  • Hi Chirag,

    DACVAL is a register in the DAC module.  You should be able to do a register read and write that information in the txMsgData buffer in the CAN transmit example.

    Regards,

    Joseph