PWM full duty cycle operation needs periodic refresh?

I am using a PWM pin at full duty cycle for what could be hours and hours.

Recently I noted that when set to full duty cycle, the PWM pin does not stay there for longer than about an hour.

Does the netMF implementation of PWM have some limitation here?

Do I need to refresh the “full on” state of that pin to keep it on?

I am using a G120 SOM.

no known reason for that that I can recall. My suspicion is its in your code, something is being GCed and you need to prevent that. Can you demonstrate a simple code snippet that can do this? You say G120, but you don’t say what version SDK/Framework you’re targeting, and that will also be important to know.

Thanks for identifying GC as the issue. I think reading Chapter 9.1 of the “Beginner’s Guide,” titled “Losing Resources” will be a good start.

@ User_10319 - where did you download the guide?

@ Gus, the link to the guide I followed was the result of a Google search. It made me wish I had spent more time on this site and on TinyCLR. Here is the title page information: September 24th 2012 Rev 2.1 Copyright © 2012 GHI Electronics, LLC www.GHIElectronics.com Community: www.TinyCLR.com Gus Issa

@ Brett, once I started forcing GC to run it was easy to track this down. I had mistakenly initialized a pin twice. I’m assuming that when GC ran it saw an unused object and disposed of it, thus un-initializing the pin. GC ignored the fact that another object was using the pin, which is good to know so I can protect against it.

I think I saw some discussion on this forum about a similar issue.

Thanks to the community, I found a fix to this issue much sooner.