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.

AM335x DMTimer Enable/Disable High Latency (~60 us)

Other Parts Discussed in Thread: AM3359

I have an issue with an unusually long latency of ~60us for enabling/disabling DMTimer on AM335x.

I originally posted this issue on the StarterWare forum: http://e2e.ti.com/support/embedded/starterware/f/790/t/314982.aspx

This issue may not necessarily be caused by the StarterWare, so I am posting it again here.

 --------------------------------------------------------------------------------------------------------------------

Hello,

I have a board with the AM3359 processor, running at 600 MHz.

I am using CCS v5.4, SYS/BIOS 6.35.1.29, and the Sitara SYS/BIOS Industrial SDK v1.1.0.1.

I am using the DMTimer peripheral for my application.

More specifically, I am using DMTimer3 in one-shot mode, and I start the timer roughly every 500us.

While using the RTA Execution Graph, I noticed that the ISR for the DMTimer takes an unusually long time. After commenting out "DMTimerDisable(SOC_DMTIMER_3_REGs)" I noticed that the execution time improved by 60us, indicating that disabling the DMTimer was taking 60us. The CPU Load of my application also fell from 55% to 45% when I commented out that one line of code. "DMTimerEnable(SOC_DMTIMER_3_REGs)" also takes 60us. Clearly, something is very wrong. A 600 MHz processor should not take 60us to write to a register.

I had some difficuly getting the SYS/BIOS HAL API and the StarterWare from the SYS/BIOS Industrial SDK to work well together when configuring the DMTimer peripheral. My previous difficulties with the configuration are discribed in this post: http://e2e.ti.com/support/arm/sitara_arm/f/791/t/194331.aspx

 I was finally able to get the timer configured, and it "works", but apparently there may still be some issues, as indicated by the extremely long time it takes to enable/disable the DMTimer.

I would appreciate any information that might help to diagnose why toggling the DMTimer peripheral is so sluggish.

Thanks.

  • I figured out what is wrong. I have been using a 32 kHz (32768 Hz) clock for my timers. The period for this clock is ~30 us. Apparently it takes a couple of clock cycles to start or stop the timer. Therefore, it took 2 x ~30 us = ~60 us. That explains why starting or stopping the timer took so long.

    I solved this problem by switching the timer clock sources to 24 MHz (CLK_M_OSC). This much faster clock has a period of a few 10s of nanoseconds, so the clock cycles or "ticks" are much faster. Therefore, the couple of clock cycles it takes to start or stop the timer are in the 100s of nanoseconds. This is a dramatic improvement over 60 us!

    So if you want to stop/start the timer quickly, you must use a high-frequency clock (i.e., CLK_M_OSC) for that timer.

  • Thanks for sharing your solution Jonathan. This is helpful for other forum users.