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.

TMS320F28379D: MCU communication with desktop application like PCAN tool using CANA interface

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE, CONTROLSUITE

Hi all,

The contolcard experimentkit has been interfaced with CAN transceiver to communicate with PC application assume PCAN viewer.

Refering the ti\c2000\C2000Ware_1_00_01_00\device_support\f2837xd\examples\cpu1\can_loopback_bitfields example which has mux configuration to support for gpio31 and 31.

#if 0
GPIO_SetupPinMux(30, GPIO_MUX_CPU1, 1); //GPIO30 - CANRXA
GPIO_SetupPinMux(31, GPIO_MUX_CPU1, 1); //GPIO31 - CANTXA
GPIO_SetupPinOptions(30, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinOptions(31, GPIO_OUTPUT, GPIO_PUSHPULL);
#endif

The transceiver connected in my case is GPIO70 and GPIO71, then configured the mux as follows, it is working as expected. the loopback is working fine, attached the screenshot.cana_loopback.zip

//To support gpio71 with cana

GPIO_SetupPinMux(70, GPIO_MUX_CPU1, 5); //GPIO70 - CANRXA
GPIO_SetupPinMux(71, GPIO_MUX_CPU1, 5); //GPIO71 - CANTXA
GPIO_SetupPinOptions(70, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_PUSHPULL);

Now I have to configure the CANA to communicate with desktop i.e PCAN Viewer, please let me know what are the settings, have to configure.

I could able to find one more example in which it has a communication between CANA and CANB (ti\c2000\C2000Ware_1_00_01_00\device_support\f2837xd\examples\cpu1\can_external_transmit).

Analyzing both the examples to find out the configuration values, if anybody knows are already done please let me know.

Thanks

  • Hello

    I don't follow what your question is. I can assist with questions on how to set certain configurations for CAN but don't know specifics for PCAN tool.

    Best regards
    Chris
  • Ashok,
    I don't know exactly what you mean by "what are the settings". In order to use PCAN to monitor CAN messages over CAN bus, you need to use a CAN transceiver connected to your MCU and also terminate the CAN bus properly, 120 ohm resistor at each end, then you should be able to see CAN messages on PCAN.
    Regards,
  • Hi Khashayar olia/Christopher Chiarella

    Thanks for you are attention.

    Will reframe the question, using PCAN tool will send the CAN message, the MCU should able to receive it.
    With current configuration settings, communication from MCU to PCAN is happening.
    What are the configuration register settings required for communication from PCAN to MCU?

    Thanks
  • I'd start with the can external transmit example and remove the CAN-A logic. The CAN-B is setup to receive, so should be able to use that a place to start modifying to receive data from PCAN.

    Best regards
    Chris
  • Hi Christopher Chiarella,

    Thanks for you are attention.

    Even I started working like that only, in my setup CANA has to setup for transmisstion and receiption, Please find the attached files for modified code for CANA external tx and rx(can_external_transmit.c), another one only for CANA rx(can_ex_rx.c).

    Still not wroking as expected, If I want to setup a CANA for both Transmission and receiption of a message Is there any other register settings has to modify. Please comment on this.

    Thanks cana_tx_rx.zip

  • can_ex_rx.zipHi Christopher Chiarella,

    f28379d able to receive message from PCAN tool, Issue has been fixed, added delay in the while 1 loop.

    The code has to improve,  Instead of delay better to add a code to check the status registers. Please have a look on give me a comments.

    Thanks

  • Good to hear! You can have it use interrupts or polling. The delay likely helps so that you have time to receive the interrupt before hitting the ESTOP.

    Best regards
    Chris
  • Hi Christopher Chiarella,

    Instead of CAN apis, wanted to use bit field strucutres for CAN functionality, TI has any plan to release CAN examples with CAN apis bit field strucutres in c2000 ware?

    Thanks

  • You are already using the bitfield CAN example that uses the bit field structure header. (can_loopback_bitfields).

    There aren't any plans to create bit field APIs since we are focusing on driverlib.

    Best regards
    Chris
  • Hi Chris or all,

    Used CAN apis provided from deprecated folder in c2000 ware.

    I got one reference from contolsuite(C:\ti\controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Cpu1\can_loopback_bitfields\cpu01).
    which has tx and rx in loopback mode.
    Here again am facing same issue, I created the two separate projects for tx and rx, accordingly modified the source code.
    Tx is working as expected, could able to receive the messages using pcan tool which is running on PC, i.e MCU able to txfer the packets.

    Rx is not working as expected, if I send message using pcan tool not able to receive by MCU.

    Please provide me a few debugging techniques on DCAN module.

    Thanks
  • This is just a couple things that could be checked/verified:
    - Try adjusting bit rate
    - Try different message object
    - Check the mask and filtering for the message IDs
    - Check error register
    - Can try monitoring the bus with scope

    Your bus sounds fine since you can send packets.

    Best regards
    Chris
  • Hi Christopher Chiarella,

    Thanks for you are reply.

    I could see strange behaviour on dcan bus interface on my setup.

    If I try 10 times 5 times could be able to receive the message from the PCAN tool.

    When issue happened, need to reinvoke the tool and used to re trigger the transmission on the pcan tool.

    Even on the board side also might be a loose connection on transceiver daughter card.

    Thanks