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

Softdevice crashes with PPI

Hi

I've made a small application on a NRF51422 device. It's is loaded with the newest version of S320 and the newest API from you homepage.

In my application i need a couple of PWMs to trigger some external hardware. These PWMs are created using Timer2 and some PPI events/tasks Without the Softdevice enabled this works flawless. However, if the Softdevice is enabled the application crashes into a hard as soon as I set up the first CH it will jump into the HardFault handler.

I've stolen some code for setting up the Softdevice from one of the example projects (\Nordic\nrf51422\Board\nrf6310\s310\ble_app_hrs), so I'm pretty sure that part is correct - even though it's not really that platform I'm working on. I'm calling the function ble_stack_init() to initialize everything.

My set-up of the PPI channels is as so:

NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TIMER2->EVENTS_COMPARE[0]; // event when reaching the duty cycle value
NRF_PPI->CH[0].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];
NRF_PPI->CH[1].EEP = (uint32_t)&NRF_TIMER2->EVENTS_COMPARE[1]; // event when reaching the max counter value
NRF_PPI->CH[1].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];

As far as I can see from the debugger the app will chrash as soon as i execute the first line above. I've tried changing the channel numbers around a bit, but I get the same result.

I've tried switching the order around, so I'll enable the Softdevice first, and then set the PPI channels. This appear to be working - atleast it doesn't chrash. However(!): If I then enable Timer2, as I need it for the PWM, during the PPI set-up (before enabling the SD) the SD enabling will throw the "NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION" error.

So I guese my questions are: 1: Are there any kinds of rules I'm not aware of saying you are not allowed to change the PPI while the SD is enabled. 2: How do I fix the interrupt error thrown?

The hardware is one of Dynastreams eval boards, but I don't think it's an hardware issue.

Best regards

Parents Reply Children
No Data
Related