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.

How to read the global timer in OMAP 4430?

Other Parts Discussed in Thread: 4430

I am trying to read the global system timer for Cortex A9, OMAP 4430 architecture (pandaboard rev A6). I used this OMAP 4430 TRM where is said that register of global timer has this base address 0x48240600 with offset 0x200. Is it correct address for system timer? Now when I try to map and read this addresses, I always get 0 and it seems to me that something is wrong.

Earlier I could managed the same issue with beaglebone board (AM335x architecture). There were different registers, different addresses, but I hoped that the idea of reading the timer would be the same. That's way I am asking, may be there are some additional tricks of reading this register for OMAP 4430?

To be more precise, this is the way how I read counter:

#define MAP_SIZE 4096UL
#define MAP_MASK (MAP_SIZE - 1)
volatile unsigned char* gpt_regs;

constexpr uint32_t GPTimer = 0x48240600;
constexpr uint32_t offset = 0x200;

int32_t fd;

if ( (fd=open("/dev/mem", O_RDWR|O_SYNC) ) < 0)
{
perror("open");
exit(-1);
}

gpt_regs = (unsigned char*) mmap(0, MAP_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPTimer & ~MAP_MASK);
uint32_t counter1 = * (int32_t*) ( gpt_regs + offset);


I will appreciate any help.

  • In OMAP4430, 3 types of timers there.
    11 GP (general purpose) timers
    1 WS (watch dog) timer
    1 32K timer

    You can get the base address of timer in OMAP4430 TRM guide chapter 2 "Memory Mapping"
    Refer chapter 22 and table 22.2.6 & 22.21

    http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=swpu231&fileType=pdf

    For ex:
    If GPTIMER1 ( GP timer 1)
    Base address - > 0x4A318000

    What timer are you trying to use ?
  • Hello Titus,

    Thank you for a reply. I will try to give more details of my issues.

    My aim is to read values of the main system counter, which Linux system call invokes (e.g. clock_gettime()).

    For example, with AM335x architecture (beaglebone white, Cortex A8) I concluded that it was 24MHz clock and DMTimer2 register. As I understood, the Linux kernel already contains dmtimer driver, which allows using system time through accessing to this DMTimer2 register. I maped its address 0x48040000 with offset of 0x3c and simply get ticks value.

    Now with OMAP4430 (pandaboard rev A6, Cortex A9) I am trying to do the same. Yes, firstly I have to figure out which exact timer and register is used by Linux system call. Secondly, how to access it. Honestly, I have already tried to maped and read each of 11 GPtimers registers and I received either zero or bus error or like in case of GPTimer1 just random constant value which is not incrementing.

  • Understood.
    Which SDK version are you using ?

    Is that from TI or 3rd party ?
    Need to check the linux source to know about timer informations which is configured for system timer (ticks : jiffies)
  • I am working directly on the board:
    Debian GNU/Linux 7 (wheezy)
    3.9.11-x5 kernel version

  • Titusrathinaraj, I am sorry for disturbing, but can I ask, will I get any additional information regarding my question?

  • Just I requested you the OMAP4 SDK version and not Host details.
    Okay.

    Check the following file for clock event for OMAP4.
    arch/arm/mach-omap2/timer.c

    I think, GPTIMER 1 is used for CLOCK EVENT.
    Try to read GPTIMER1 register to read the time.

    http://elinux.org/Kernel_Timer_Systems