Report
2 months, 2 weeks ago.

PWM on nRF52 (uBlox Nina-b1)

Hi,

I need PWM for a project I am using the uBlox nina-b1 module on. Anytime I try to load a code that uses PwmOut the module freezes. From what Ive read in the forum it seems like there is some issue with mbed and the nRF timers . Is there a good way to get around this? Maybe using a lower level call the nordic SDK functions? Any help would be greatly appreciated.

Thanks, Calvin

Comment on this question

1 Answer

2 months, 1 week ago.

Hi Calvin,

What version of Mbed are you using?

A problem impacting the PWM on v5.9.1 and later was recently identified for the Nordic nRF52 family and you might be hitting the same issue. A pull request (which also fixes another PWM issue) is under review, please see:

If you are using v5.9.1 you can try to use this commit if you can't wait for the review:

-Ralph, Team Mbed

Note: Post updated to include screen capture:

/media/uploads/RalphF/onlinecompiler-switchosrevision.png

Thanks for getting back to me Ralph.

I am using the online compiler (not sure how to check version number). I see 1.10.14.0 in the top corner but that doesnt seem like the right number format. I updated all the libraries/docs for my project and the program still hangs when I try to use PwmOut.

posted by Calvin Bond 13 Aug 2018

Hi Calvin,

If you are using the Online Compiler try reverting back to Mbed OS v5.9. I will update my original post to include a screen capture which shows how to do this. In summary, the steps are:

  • Select mbed-os in the Program Workspace
  • Select Revision from the top menu
  • Select mbed-os-5.9.0 from the top table (the screen capture shows v5.9.1 being selected)
  • Right-click mbed-os-5.9.0 and select "Switch working copy to this revision"
  • De-select Revision to return to the Program Workspace code view

Note: The selected OS version will show as bold if you want to double-check which is selected

Then you can rebuild your project. Hopefully you'll see the PWM working as expected.

-Ralph, Team Mbed

posted by Ralph Fulchiero 14 Aug 2018

Looks like v5.9.0 works with PWM. I tried v5.9.5 and it does not appear to work. Could you walk me through using the commit you suggested to apply the fix to 5.9.5?

edit: Can you comment on Sleep/DeepSleep functionality back to v5.9.0? I had a code that was idling at 3.5mA and with the v5.9.0 commit it is idling at about 8.5mA. I implemented some PWM driving and switched to the older version. I tried commenting out PWM function in case that was keeping it from sleeping but it does not seem to fix the issue.

I wasnt seeing a way to turn off a PWM signal (writing it to "0.0f" freezes the device. Is there a way to write the pin low?

Thanks again

posted by Calvin Bond 16 Aug 2018

To post an answer, please log in.