This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52, 1-4 MHz clock needed

I am using the nRF52 Preview board, PCA 10036. I need to provide a high-frequency clock signal to a peripheral. Anything between 1 and 4 MHz will work. However, I don't need and don't want the CPU to receive an interrupt on every clock pulse.

I think that the GPIOTE example in the SDK is relevant to my needs. (I'm using SDK 0.9.2.) However: the code has a function called timer_dummy_handler(). While this function does nothing, the code does connect it to a timer event, with a call to nrf_drv_timer_init(). The documentation for nrf_drv_timer_init() says that an event handler function is a required argument.

The GPIOTE example code has a timer frequency of 200 milliseconds. Calling a quick and useless function five times/second is harmless. Calling that same function 1-4 million times / second would be a nightmare.

Is that function call actually used?

Can I avoid attaching a function call to a timer event, if I program at a lower level?

Parents
  • seems pretty simple - run one of the TIMERs, set the COMPARE to whatever gives you 1-4MHz, enable the short between COMPARE and CLEAR and set up a PPI to toggle a GPIO pin on the COMPARE event. Now you have a 1-4MHz toggling GPIO pin with no CPU involvement, just the power use from the HKCLK running.

  • Thanks for your reply, RK. You may not recognize my name, but I'm rather new to embedded systems programming, and you have helped me several times.

    I think you are telling me that I guessed correctly when I said that I need to program at a lower level. I won't use the timer driver, instead I use the hardware abstraction layer. This may apply to other parts of the program too, I'm not sure yet.

    I am reading through the hardware specification for the chip and trying to grasp all that it can do. The SDK examples do not show any of this low-level programming. If you know where I can see and learn more, I would appreciate a link. Thanks.

Reply
  • Thanks for your reply, RK. You may not recognize my name, but I'm rather new to embedded systems programming, and you have helped me several times.

    I think you are telling me that I guessed correctly when I said that I need to program at a lower level. I won't use the timer driver, instead I use the hardware abstraction layer. This may apply to other parts of the program too, I'm not sure yet.

    I am reading through the hardware specification for the chip and trying to grasp all that it can do. The SDK examples do not show any of this low-level programming. If you know where I can see and learn more, I would appreciate a link. Thanks.

Children
No Data
Related