SDK timer question

Because I’m new to Nano I’m studying the blinky example.

So I am trying to understand the get_timer_value() function in n200_func.c of the framework-gd32…-sdk. What I can’t figure out is where did the value for

#define TIMER_CTRL_ADDR           0xd1000000

inside n200_timer.h come from.
The GD32VF103_User_Manual V1.0 has no definition for 0xd100_0000 yet based on the name it must be an address associated with the timer registers. I would have expected something like 0x4000_2C00.

The best “guess” I have is that it’s an address associated with the N200 RISC-V Kernel-owned timer unit. The docs for the processor are all in Chinese :grimacing:

Does anyone have a clue?

Thanks.

Yes, but only a clue - I’m still working my way through the timer peripherals.

It seems you’re correct that this is the core’s timer. Normally this would be accessed via CSRs, but to simplify implementation it is memory mapped into the address space.

Bumblebee Processor Core Concise Data Sheet : 2.14. Timer unit of the Timer unit of the Bumblebee kernel has a note that states this.

Bumblebee Processor Core Instruction Architecture Manual : 6.1.2. Timer register lists the registers in the mapped block. (PDF page 144).

It also states that

The base address of the TIMER unit in the Bumblebee kernel is described in
the Bumblebee Kernel Concise Data Sheet.

but I can’t find any reference to the base address in there. It must be defined somewhere, since whoever wrote the header framework-gd32vf103_sdk-v1.0.0/RISCV/drivers/n200_timer.h clearly had this information.

1 Like