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.

CCS/TM4C123GH6PM: simpletx change in periodicity

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

im using simple tx example program for can bus communication, while im trying to change the periodicity of data to 2.5 ms, it is not changing.

i change the simple delay, but it is not reflecting. how to change the data period to 2.5ms. 

  • Remember that the simple delay is the time between the executions of the loop. Within the loop you are sending the CAN frame and printing out the UART. Most of the time is spent printing out the UART. I changed the SimpleDelay() to 2.5mS 

    void
    SimpleDelay(void)
    {
        //
        // Delay cycles for 2.5ms
        //
        SysCtlDelay(16000000 / 1200);
    }
    

    Then captured the CAN transmission on a logic analyzer. The frames came roughly every 10mS.

    Then I commented out the UARTprintf() statements and re-ran the code. Now you see it is closer to every 2.5mS.

    But it is still not exacly 2.5mS. The reason is the simple delay starts after the CAN transmission. The time to send the CAN frame is added to the period. If you need more precise timing, you should have a timer interrupt every 2.5mS and start the CAN transmission. Here is what the CAN frame looks like at 500KB.