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.

TM4C123BH6PM: Lost CAN massage object (2)

Part Number: TM4C123BH6PM

Hi Team,

The customer provide the project to re-produce with Tiva DK-TM4C123G.for the following E2E thread, I attached it.

Would you please investigate it?

The original thread is locked. So I create new one.

TM4C123BH6PM: Lost CAN massage object

https://e2e.ti.com/support/microcontrollers/other/f/other-microcontrollers-forum/994417/tm4c123bh6pm-lost-can-massage-obje

TestDK_Bord.zip

< TI.png>

<ti2.png>

The condition of the can bus when #if is set to 1 on line 186 is indicated in the attachment "TI.png", Can bus status when #if is set to 0 on line 186 is attached "ti2.png"

Thanks and Best regards,

 Kuerbis

  • Hi Akemi,

      I will need some time to investigate this as you know the CAN module as well as the protocol is complicated unlike UART or SPI. If I find something I will reply but most likely not until next week. Please set the expectation straight with your customer. 

  • Hi Akemi,

      I have some updates. 

    I think the reason that you are seeing only the last message on the bus is because the TXRQST bit is immediately cleared by the hardware when you disable the auto-retransmission. When you call CANMessageSet, the software is supposed to set the TXRQST bit and after a successful transmission, and if no new data was
    written to the message object since the start of the transmission, the TXRQST bit in the CANTXRQn register is cleared. However, if the retransmission is disabled, then the TXRQST is somehow cleared before the transmission has completed. When this happens, your check using CANStatusGet will return 0 and it will result in calling CANMessageSet repeatedly for 10 times. In another word, the 10th message will overwrite all the prior 9 messages in the message object before the transmission is started. This is why you are seeing the last message on the bus. 

     I found two workarounds. 

      - First workaround is to wait for the TXOK to interrupt. A TXOK is a status indicating the transmission has completed.

      - Second workaround is to wait for the message object. The message object TX interrupt will work the same way. Message object TX interrupt is only generated after the transmission is complete.

      Attached are two different workarounds. 

    main_use_message_object_interrupt.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_sysctl.h"
    #include "inc/hw_can.h"
    #include "inc/hw_ints.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    #include "inc/hw_can.h"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    main_use_TXOK_status_interrupt.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_sysctl.h"
    #include "inc/hw_can.h"
    #include "inc/hw_ints.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    #include "inc/hw_can.h"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Charles,

     

    Thank you for investigating and finding the workarounds.

    I already inform those to the customer and waiting their feedback.

    If they have any questions and problem, please support them.

     

    Thanks and Best regards,

    Kuerbis

  • I am the customer to ask this problem.
    Thank you for your advice about the reason and the workarround.
    I understood these.

    But, if possible,
    I want to use TXREQ bit check, becouse I do not want to use some interrupt.

    Now, I can not use sending theree TX objects at a time with Auto-retry disabled, using TXREQ bit check .
    But, I can use sending only one object at a time with Auto-retry disabled, using TXREQ bit check.
    (Using project : main.c Line186 #if is set to 1)

    If the product specifications of TM4C123BH6PM is no problem using my project, I want to use TXREQ bit check.

    Please comment.
    Thanks and Best regards,

  • Hi Yuzo-san,

    But, I can use sending only one object at a time with Auto-retry disabled, using TXREQ bit check.
    (Using project : main.c Line186 #if is set to 1)

    If the product specifications of TM4C123BH6PM is no problem using my project, I want to use TXREQ bit check.

    As I explained in my previous reply, the CANStatusGet() will immediately return 0 if you disable auto-retransmission. Therefore, calling CANStatusGet() is not a reliable way to determine if the CAN message object has been sent out successfully or not. I recommend you consider my proposed workarounds. Did you try them? Please try them to see if they work for you.  

  • Thanks for kind comment.
    Your explanation was very thorough.
    I try to fix my project using your proposed workaround.