This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Searching For Documentation... NRF_TIMER4->MODE =

Good day to you,

I cannot find any reference/documentation whatsoever that relates to the following type of code... 4 lines of example code is below (from this link https://forum.arduino.cc/t/measuring-pulse-time-with-timers-gpiote-ppi-on-the-arduino-nano-33-ble-sense/699552)

NRF_TIMER4->MODE = TIMER_MODE_MODE_Timer;

NRF_TIMER4->TASKS_CLEAR = 1;

NRF_TIMER4->PRESCALER = 4

NRF_TIMER4->BITMODE = TIMER_BITMODE_BITMODE_16Bit;

From the above link you'll notice that it's related to Arduino, which I've been using so far, but I need to use/learn GPIOTE to achieve 1 micro second precision timing for generating PWM and PPM for servo control.

The above code sample's library is located within Arduino's installation folder structure, i.e., the sample is not directly dependent on Nordic's nRF5 SDK.

My question is... please can someone tell me where to find documentation that explains such instructions as those in the above example?

I'm using a Nano 33 BLE which itself uses a NRF52840

Like I say it'd be really great to get some help with this, thanks, Gary.

Parents
  • Hello Gary,

    These are the registers. If we consider NRF_TIMER4 (for example) , it is just a pointer to the HW register.   

    ...

    You can see from the above table that the base address of TIMER4 is 0x4001B000. Its the peripheral and each register has an offset from that address.  These offset registers  (for example: TASKS_START, TASKS_STOP etc) are the address location added to the base address in order to get access to a specific address in terms of task pattern.

    You can use these peripherals (TIMER0, TIMER1.. and so on) the way you use instances in C programing. Each time instance have their own address; but the offsets between individual registers are the same for all instances. 

    You can see the Timer instances and offset registers here. https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Ftimer.html&cp=4_0_0_5_29_4&anchor=topic ,

    It is defined in nrf52840.h (nRF5_sdk_folder\modules\nrfx\mdk) file.

    #define NRF_TIMER4 ((NRF_TIMER_Type*) NRF_TIMER4_BASE)

    #define NRF_TIMER4_BASE 0x4001B000UL

    Hope it helps.

    BR

    Kazi Afroza Sultana

  • Hi Kazi, that's the best answer anyone has ever given to me about anything, it really is...

    Thank you so much Slight smile

Reply Children
Related