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

nRF51 BLE and PWM doesn't work simultaneously

Hi

I'm using a custom board with nRF51822 and mbed. Then, I would like to generate 25kHz PWM and use BLE simultaneously. So, I read this thread, write like the attachment code and could generate 25kHz PWM. devzone.nordicsemi.com/.../ source code.txt

However, I couldn't use BLE while my board generates PWM. Although I changed the frequency of PWM, I couldn't detect BLE. Are there anyone who face the same problem? If there are, please tell me how to solve this problem.

Best regards Ishikawa

Parents
  • Creating PWM with variable duty cycle on nRF51 is hard, which is why the pwm library in the SDK was not stable until SDK 10 and later. If you only want a square wave signal with fixed frequency and duty cycle (like 50%) it is not that hard and you can do it as you purposed/as done in the linked post.

    Some things that might cause problems:

    • You are using SDK function nrf_gpiote_task_config(..). I do not know if you can use this in mbed.
    • You are using PPI channel 0. This might be used by other modules. Try using channel something else like channel 10. You should also use NRF_PPI->CHENSET instead of NRF_PPI->CHEN to avoid clearing all the other channels.

    You are not enabling timer 2 interrupt in the peripheral and you don't need the interrupt, so you don't have to enable it in the cortex (NVIC_EnableIRQ(TIMER2_IRQn)).

Reply
  • Creating PWM with variable duty cycle on nRF51 is hard, which is why the pwm library in the SDK was not stable until SDK 10 and later. If you only want a square wave signal with fixed frequency and duty cycle (like 50%) it is not that hard and you can do it as you purposed/as done in the linked post.

    Some things that might cause problems:

    • You are using SDK function nrf_gpiote_task_config(..). I do not know if you can use this in mbed.
    • You are using PPI channel 0. This might be used by other modules. Try using channel something else like channel 10. You should also use NRF_PPI->CHENSET instead of NRF_PPI->CHEN to avoid clearing all the other channels.

    You are not enabling timer 2 interrupt in the peripheral and you don't need the interrupt, so you don't have to enable it in the cortex (NVIC_EnableIRQ(TIMER2_IRQn)).

Children
No Data
Related