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.

CSL timer interrupts and system_printf for PDK and C6678 processor

Other Parts Discussed in Thread: SYSBIOS

 

I am using ccs5.1 and using PDK_c6678_1_0_0_19. I have making use of the intc library within CSL to program an interrupt to go off every 10ms and call an ISR in which a semaphore is posted so that  till the interrupt goes off every 10ms, the main task can be stuck at the semaphore pend statement in a while loop. This way whenever the interrupt happens the task wakes up essentially to do some processing.

I have the code working with the semaphore_post/pend etc and I am making use of the function test_high_continuous_timer as part of the timer_test.c file in the CSLexample directory in the pdk section. However, it would appear that using system_printf results in an interaction with the timer and so I can no longer get the timer to go off every 10ms anymore, it appears to go off a lot faster. I know that when I make use of the TSCL counter to measure time and print using system_printf it works till I call the system_printf. On subsequent calls it then no longer works. Please see this thread under the multicore forum.

http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/190112.aspx

I would like to be able to print out stuff without impacting the timer interrupt, how could I go about doing that and is this because I am using SYSBIOS and the CSL interrupt/timer etc?

Thanks, Aamir

  • Aamir,

    This is exactly why we do not recommend calling System_printf() from an interrupt.  System_printf() is slow and can potentially have an effect on the target code.
    Did you disabled Asserts?  If you didn't,  you should have received an Assert for calling System_printf() from an interrupt.

    Now, it is possible to call System_printf() from an interrupt but you need to set System to use SysMin in your *.cfg:

    var System = xdc.useModule('xdc.runtime.System');
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    System.SupportProxy = SysMin;
    SysMin.flushAtExit = false;

    Now when you do this, you only get the prints on the console when your program exits or you call System_flush().  Again, you should not call System_flush() in an ISR.

    If you really want to print stuff in real-time, then you need to look into using Logger and the RTA tools to see the prints.

    Judah

  • Judah,

    Thanks for your post. I did manage to get my code working properly with the system_printf. I was not calling the system_printf from an ISR but in the main task. What I found was that if I did the system reset in the debug perspective, I needed to run the global default setup under scripts->EVMc6678 init functions to get it working properly. When I did not run that, the code seemed to work except for the fact that the TSCL timing was not consistent with the actual time and was slower by a factor of 10 so 5 seconds of time using the TSCL counter would correspond to 50 secs of real time. We were making use of the derivative of printf, more like a sprintf in our product and though it takes a lot of time, we do use it for debug purposes to debug our code when problems occur and were able to run it every 10ms so it was able to take a less than 10ms to run to completion without negatively impacting the behaviour as long as the desired code was not taking close to 10ms of processing time.

    Thanks though for your note.

    Aamir

  • Hello TI Folks,

    I am replying on this thread as I was away from this project for a few months and have restarted looking again at the issue of having a application loaded on multiple cores with each core waking up every 10ms to begin some processing. When I was last looking at this in early June I was able to get my timer interrrupt code working for a single core were I would initialize the INTC module then the timer CSL module then initialize and setup the QMSS, CPPI, switch and PASs subsystems and setup the TX and RX setup for sending and receving data to/from PASS. I finally then setup a high timer in continuous mode (unchained) and then began a main task infinite while loop in which I have a while(timerTickCount != 1); loop so when 10ms expires for a single core the timer ISR is called which set timerTickCount to 1 and so this while loop is exited and I reset timerTickCount=0 and the code can then begin to check for any received packets from the PA by calling a function ReceivePacket which is based on the TI multicore example. However, when I go to multiple cores and load the application on say two cores I am no longer able to get this 10ms interrupt to work. I had included my main multicore App example source code earlier in the thread http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/190112/768375.aspx#768375 Do I need to have 8 of these timers setup for each core or can I have one timer go off and cause all 8 cores to wake up? Is the TSCL register shared by all the cores?  The setup_high_continuous_timer code is modelled on the timer code in the CSL directory within the PDK directory. Also once the timer is started, I exit the setup_high_continuous_timer function.

    Any help would be appreciated.

    Thanks, Aamir