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-TMS57004: How to use two RTI functions in the TMS57004?

Part Number: LAUNCHXL-TMS57004
Other Parts Discussed in Thread: BQ76PL455EVM, BQ76PL455A

HI,

I'm used bq76pl455EVM  board with TMS570432 board,and I set RTI function in the sample code.

In the bq76pl455 example code it already use the RTI compare 1 to receive the SCI batteries data.

Now I'm try to add compare 0 to do something(like LED blinky),but it can't work.

The compare0 use counter1 and in sample code use compare1 with counter0  receive data , they use different counter.

I even try a new project for use two compare to do LED blinky it can work normally.

But when I add in bq76pl455EVM example code it can't work.Is the SCI RTI compare1 cause the another compare didn't work?

Please help me,Thanks!

This is my new project GIO is work normally. and bq76pl455 example code project.

bq76PL455A-Q1 Example Code 1.0_0715.rar

5488.GIO.rar

  • Hi ,

    I verified your code and i found the root cause for the issue. 

    I saw you are enabling Counter for block-1 in the function "StateMachineTask"

    And this function "StateMachineTask" is calling after the "bq_init_device" function in main loop.

    If you verify carefully the function definition of "bq_init_device", it have while(1) at the end of the definition

    So because of this the processor can't execute the function "StateMachineTask" and it cant start the counter-1 and our compare operations of Counter1 can't be performed.

    --

    Thanks,
    Jagadish.

  • Hi, gundavarapu

    Thank you reply me.

    I mark the while(1) can function,but it still can't enable counter1.

    And I find when the batteries data receive finish the code will exit.

  • Hi,

    There should be one infinity loop in your code, if infinity loop was not there then your code program will get terminate. So after commenting while(1) in "bq_init_device" function just try to add infinity loop after "StateMachineTask" function.

    --

    Thanks,
    Jagadish.

  • Hi, Jagadish gundavarapu

    Thank you reply me.

    Now I set the  infinity loop in my code for LED blinky.

    And I use debug mode to watch the code step by step to trace the code.

    I find the code could be enter StaeMachineTask subroutine but it can't trigger the counter1.

    appendix is my debug video and my modify code zip .Please watch my video Thank you.

    bq76PL455A-Q1 Example Code 1.0_0718.rar

  • Hi,

    Now i don't see any mistakes in your initializations, it should work.
    Can you please do the following verifications?

    1. Can you set a breakpoint at starting instruction of "rtiNotification" function, like below

    Don't set breakpoint anywhere else and do continuous run(not step by step) and verify whether it is hitting above breakpoint or not?

    2. If above breakpoint not hitting even after running some 3 to 4 seconds also then just pause the execution and see the RTIFRC1 and RTIU1 register values in register window of debug and the these registers should have a non zero values if the counter1 is running. If counter1 is not running then the values will be zero

    See in my debug i can see non zero values in this registers.

    You can add this window by below navigation 

    --

    Thanks,

    Jagadish.

  • Hi, Jagadish gundavarapu

    Thank you reply me!

    This is awesome explain for me.I got the value in RTIFRC1 and RTIU1 register.(figure 1)

    Now i can work short time, but something strange to the running code.

    I write the infinite loop for StateMachineTask(figure 2) , but the code will infinite execute the main( ) .

    I try to find the problem,so I use debug mod to trace.

    When the compare 0 execute one time and the code will go to sys_startup.c to reset the code and it is infinite to do that.

    I show the debug video for you .

    Thank you.

                                          figure 1

                                             figure 2

  • Hi,

    This issue is not triggering at my end. Can you please do the following things on your side?
    1. Keep "rtiStartCounter" function out side the infinity loop, remove this function from "StateMachineTask" this function and place this function before starting of infinity loop like below

    This is because, start counter operation is may not required to call again and again. After calling first time itself it will start the counter and the counter will continuously in running.

    2. Keep the breakpoint at start of the main like below and don't place the breakpoints anywhere else

    Now debug the code in continuous run mode and don't do line by line debug. The above breakpoint should hit only one time, that is at the beginning of the debug. If it is hitting again in continuous mode means, then the controller is restarting and there is some error in the code.

    --

    Thanks,
    Jagadish.

  • Hi, Jagadish gundavarapu

    Thank you reply me !

    I follow your tech and that is didn't change situation,but now I have new find maybe it have relation to the problem.

    when I modify the battery data frame printf in bq_device.c Line:262    for(i=1;i<27;i++), if the data sizes not same with the frame the code will be error(infinity reset the code)

    It can show the data suitable size ,don't show the 0 data like before, now the code just running one time and stuck in the infinity subroutine.

    My 10ms led can work but another LED(100ms) don't, counter1 just count one time and stuck the infinity subroutine.

    "rtiStartCounter(rtiCOUNTER_BLOCK1);" this command write out side the infinity loop, or put the inside is same situation.

    This video is first  show the data correct but it just counter one time and next is show mistake demo it infinity reset.

    bq76PL455A-Q1 Example Code 1.0_0719.rar

  • Hi,

    Can you try the attached code?

    Here i am calling "rtiStartCounter(rtiCOUNTER_BLOCK1)" function before the "bq_init_device" function.

    And i moved "StateMachineTask" function back to the "while(1)" you commented.

    This ensures your old code as it is, so test it now.

    bq76PL455A-Q1 Example Code 1.0.zip

    --

    Thanks,
    Jagadish.

  • Hi, Jagadish gundavarapu

    Thank you reply me !

    I follow your modify but it didn't work normally,the battery data can't receive and stuck in the delay subroutine,then RTI counter1 trigger one time,led can light. 

    when i replace back the"rtiStartCounter(rtiCOUNTER_BLOCK1)" function after the "bq_init_device" function and still put the "StateMachineTask" in bq_init_device while(1) the RTI counter1 can't work the counter always 0 and 10ms led not light.

  • Hi ,

    I guess we solved your main question

    How to use two RTI functions in TMS57004?

    But now the issue looks like with the application, i never used this application and i need time to look into application and understand it.

    --

    Thanks,
    Jagadish.

  • Hi, Jagadish gundavarapu

    Thank you reply me !

    Yes, I very appreciate to you for patient tech me and trace my code carefully.

    The timer seem can work but when i combine with my application have some error cause the code will stuck somewhere.

    I will keep going to try debug the code. 

    --

    Thanks 

    Kuan Lei

  • Hi Kuan Lei,

    Sorry for the delay, are you still stuck with the issue?

    If yes, can you give the details of your current issue?

    --

    Thanks,
    Jagadish.

  • Hi, Jagadish

    I just successful in today, and I want to tell you,

    thanks your tech actually your tech is correct.

    I try to use the point to do infinity loop and set the flag make sure my subroutine correct and it success.

    --

    Thanks 

    Kuan Lei