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.

RTOS/BEAGLEBK: Using a DmTimer Alongside TI-RTOS

Part Number: BEAGLEBK

Tool/software: TI-RTOS

Hi,

I intend to do some benchmarks on how long certain RTOS operations – such as task switching, semaphore passing, and so on – take on TI-RTOS for AM3358. To that end, I have some questions:

To my understanding, AM3358 has eight hardware modules, and TI-RTOS needs one of them to set system ticks. So, which timer does TI-RTOS use exactly? This page says it uses DMTIMER5 by default. However, in the app.cfg file, the section below seems to let me choose wich timer to use.

  • If I leave the "Timer ID" as "ANY", then APIs like "Task_sleep()" seem to work properly (e.g. sleeping for 1000 ticks with a tick period of 1ms takes 1 second). However, when I change this value, the processor hangs indefinitely at the system call Task_sleep(). Why could that be?
  • Having identified which hardware timer is occupied by the RTOS, I want to use another timer to see how many cycles certain tasks take (without resorting to TI-RTOS's Timer_Benchmark() APIs. That should be possible, right? I tried using DmTimer2 to take simple time measurements by directly accessing the TCLR (for control) and TCRR (for value) registers, but if I mark the "Add the clock support module to my configuration" option in the app.cfg file, my DmTimer initialization routine hangs indefinitely as well. Here's how I've been accessing the timer registers:

#define DMTIMER2_REGS_ADDR 0x48040000

#define TCLR (*(volatile TCLR_t*)(DMTIMER2_REGS_ADDR + 0x38))
#define TCRR (*(volatile unsigned int*)(DMTIMER2_REGS_ADDR + 0x3C))
#define TLDR (*(volatile unsigned int*)(DMTIMER2_REGS_ADDR + 0x40))
#define TTGR (*(volatile unsigned int*)(DMTIMER2_REGS_ADDR + 0x44))

#define StartTimer()      TCLR.ST = 1
#define StopTimer()       TCLR.ST = 0
#define GetTimerValue()   TCRR

void InitializeTimer(void)
{
    // Configure the timer control register
    memset((void*)&TCLR, 0, sizeof(TCLR_t));
    TCLR.AR = 1;

    // Reset the timer value
    TLDR = 0;
    TTGR = 0;
}

Unfortunately, I don't have a debug emulator and the BeagleBone Black doesn't have JTAG headers anyway, so I do all thse trials by installing RTOS application binaries into a microSD card and booting the board with it.

I'll be glad if you can help me with those confusions.

Thanks in advance,

Silacko