zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.55k stars 6.46k forks source link

nRF5x Pre-programmed PPI channels #7092

Closed sam131208 closed 5 years ago

sam131208 commented 6 years ago

The PPI has 12 channels is pre-programmed for radio,it is can not modify and application by other task. Why not use these channels replace the present PPI ?example the 0,3,4,5,6 channel PPI can be replace directly!

Thanks! Sam

carlescufi commented 6 years ago

@cvinayak @anangl can you please comment on this? Is this relevant?

anangl commented 6 years ago

@carlescufi It seems to me that it is. The pre-programmed PPI channels for RADIO can be used instead of the ones mentioned by @sam131208 as long as the TIMER0 is used as the event timer. And currently it is. If the flexibility of choosing the timer should be kept, I can imagine conditional compilation of code like this one when the used timer is other than TIMER0. I guess it would be good to avoid allocation of additional PPI channels when it is not necessary.

carlescufi commented 6 years ago

Very well, thanks @anangl. I'll keep it open and instead tag it as an enhancement

cvinayak commented 6 years ago

Only 5 of the pre-programmed PPI can be reused in Zephyr's BLE implementation. But the task to refactor the controller is not simple (i.e. not doable in a day or two). Refer to: https://github.com/zephyrproject-rtos/zephyr/blob/877c4d0ca70796681557fffd1a20a2f62f782a64/subsys/bluetooth/controller/hal/nrf5/radio/radio_nrf5_ppi.h

In upstream Zephyr, PPI's 16,17, 18 and 19 are free for nRF52832. And additionally, 14 and 15 are free if PA/LNA is not enabled.

rokobert commented 6 years ago

Maybe could be good to include this setting in Kconfig: When we use TIMER0 then PPI channels is used from 20:31. If not then stays like it is in "radio_nrf5_ppi.h" now.

rokobert commented 6 years ago

Meanwhile I adopt radio_nrf5_ppi.h that I could work. It is not final solution but I think is good for starting point.

File si radio_nrf5_ppi.h.zip attached.

In begginig of file is #define CONFIG_BT_NRF52X_RADIO_EVENT_TIMER which enable to use predefine PPI's.