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

GPIOTE and PPI to monitor radio state.

Hi,

 

I am currently using nrf52840 for development, I am using 15.0.0 SDK which also contains zigbee SDK in it.

What I am planning to do is to add some codes within the zigbee example project, such as light_switch, and allow a GPIO pin (P1.03) to toggle its state (low->high->low) when zigbee is not doing Tx/Rx.

I wrote a function like below:

 

void config_ppi_and_gpiote()

{

NRF_P1->DIRSET |= 0x8;

 

    NRF_GPIOTE->CONFIG[3] = (GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos) |

                            (3 << GPIOTE_CONFIG_PSEL_Pos) |

                            (1 << GPIOTE_CONFIG_PORT_Pos) |

                            (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos) |

                            (GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos);

   

    

    NRF_PPI->CH[7].EEP = NRF_RADIO->EVENTS_END;

    NRF_PPI->CH[7].TEP = NRF_GPIOTE->TASKS_OUT[3];

NRF_PPI->CHENSET |= (0x1) << 7;

 

}

 

In above code, it is to configure GPIO P1.03 and bind it with the EVENTS_END of Radio register. I am expecting to see GPIO P1.03 toggling while I am controlling the buttons on the light_switch device to on/off the LED of light_bulb device.

I used USBee to measure the state of P1.03 but it was not toggling at all – it remains low.

 

May I know if I did something wrong in the code above? Is it the right way to achieve what I am planning to do?

 

By the way, I simply built the light_switch project and didn’t run it with softDevice.

 

 

Thanks.

Parents Reply Children
No Data
Related