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

example code to reset timer when radio pipe address matched?

Good evening,

I'm trying to understand how to use the SDK 12 to connect peripherals using PPI such that when an address match occurs (say on pipe 1's address+prefix), a timer is reset.

I'm struggling to understand how to set this up. I'm not using a softdevice, but am using the Gazell library with nrf51822 and SDK 12.2.

Ideally, I'd like to then use another PPI channel to capture that timer's value when a SPI transaction occurs, but one step at a time.

Could you help me find code which shows how to set something like this up?

  • Hey Andrew,

    You need to connect the RADIO's EVENTS_DEVMATCH event with a TIMER's TASKS_CLEAR task, and one of the SPI's events with the TIMER's TASKS_CAPTURE task. 

    I need you to open up the PPI example in SDK14.2/examples/peripheral/ppi and learn how to setup TIMERs with PPI.

    Each peripheral driver has functions called nrf_drv_<peripheral>_task_address_get() and nrf_drv_<peripheral>_event_address_get(). They are used to get the address of a specific task or event who are in turn passed to the nrf_drv_ppi_channel_assign(&yourChannel, taskAdress, eventAddress) function. Now you need to enable the given channel with nrf_drv_ppi_channel_enable(yourChannel) and the given event is now connected to the given task. 

    Cheers,

    Håkon.

Related