ESP8266 Developer Zone The Official ESP8266 Forum 2018-10-12T07:34:59+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=10365 2018-10-12T07:34:59+08:00 2018-10-12T07:34:59+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=33576#p33576 <![CDATA[Re: PWM glitches and bad frequency]]>
https://lurchi.wordpress.com/2016/06/29 ... plemented/

And try this pwm driver from the same guy who wrote that post (worked great for me):

https://github.com/StefanBruens/ESP8266_new_pwm

Statistics: Posted by Guest — Fri Oct 12, 2018 7:34 am


]]>
2018-07-10T15:25:14+08:00 2018-07-10T15:25:14+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=22030#p22030 <![CDATA[Re: PWM glitches and bad frequency]]>
I just hacked the SDKto enable the modf() functions (https://bbs.espressif.com/viewtopic.php?f=7&t=9432)... Maybe PWM is somehow linked to modudulus functions ant that breaks it...

Statistics: Posted by Pato — Tue Jul 10, 2018 3:25 pm


]]>
2018-07-10T00:57:44+08:00 2018-07-10T00:57:44+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=22022#p22022 <![CDATA[Re: PWM glitches and bad frequency]]> Statistics: Posted by AgentSmithers — Tue Jul 10, 2018 12:57 am


]]>
2018-07-09T17:10:35+08:00 2018-07-09T17:10:35+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=21986#p21986 <![CDATA[Re: PWM glitches and bad frequency]]>
I also added the user_rf_cal_sector_set() function that I did not implemented until now, but the result is the same on the PWM...
But thank you for this suggestion.


NB: Because of the wrong frequency, I assumed it's a software issue and not a hardware issue. But I also tried on an Adafruit Huzzah board with a ESP-12 module and I got the exact same behavior, so it's definitively on the software side :( (after reset, reflash, etc)

Statistics: Posted by Pato — Mon Jul 09, 2018 5:10 pm


]]>
2018-07-04T06:30:39+08:00 2018-07-04T06:30:39+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=20982#p20982 <![CDATA[Re: PWM glitches and bad frequency]]>
Pato wrote:
I'm using NONOS-SDK-2.2.0, built with esp-open-sdk toolchain.
I'll try the previous SDK in few days if I have a little free time...


Yea post back here and let us know if its any different, I'm watching this thread so I'll get a notification when you post back. One more thing. With your PyTool if you don't do it already, do a "erase" on the rom to make sure its clean and reflash your 2.2.0 as well. See if that gives you anything different.

Statistics: Posted by AgentSmithers — Wed Jul 04, 2018 6:30 am


]]>
2018-06-28T15:30:10+08:00 2018-06-28T15:30:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=20949#p20949 <![CDATA[Re: PWM glitches and bad frequency]]> I'll try the previous SDK in few days if I have a little free time...

Statistics: Posted by Pato — Thu Jun 28, 2018 3:30 pm


]]>
2018-06-27T06:41:27+08:00 2018-06-27T06:41:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=20932#p20932 <![CDATA[Re: PWM glitches and bad frequency]]>
Pato wrote:
Hey folks,

Now I'm playing with the PWM API on a ESP-WROOM-02. I can get a PWM output on the pin, but the signal is quite dirty:
    - Each cycle is preceeded by a glitch
    - The period is longer than the one set in the code, probably because of this glitch
    - It occures with different duty cycles and period.

Here is what I get with the code below (500Hz, duty cylce 50%) with the code attached. Do you now why I get this and how to fix it ?
Thanks !

[Image

Code:

#include "ets_sys.h"
#include "osapi.h"
#include "pwm.h"
#include "os_type.h"

#define NB_PWM_CHANNELS  1u          // Nb of PWM channel to be active

void user_init()
{   
    uint32 period = 2000;                      // PWM period in microsec (mini is 1000, max 10000)
    uint32 nbChannels = NB_PWM_CHANNELS;       // Nb of PWM channel to be active
    uint32 duty[NB_PWM_CHANNELS] = {22222};    // Duty cycle, in number of step of 45ns
    uint32 pinParams[NB_PWM_CHANNELS][3] = {{PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14, 14u}};
   
    pwm_init(period, duty, nbChannels, pinParams);
    pwm_start();
}



That's interesting, What SDK version are you on. Can you safely snapshot (if its a VM) and move to the next neighboring major version?

Statistics: Posted by AgentSmithers — Wed Jun 27, 2018 6:41 am


]]>
2018-06-26T18:35:04+08:00 2018-06-26T18:35:04+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10365&p=20919#p20919 <![CDATA[PWM glitches and bad frequency]]>
Now I'm playing with the PWM API on a ESP-WROOM-02. I can get a PWM output on the pin, but the signal is quite dirty:
    - Each cycle is preceeded by a glitch
    - The period is longer than the one set in the code, probably because of this glitch
    - It occures with different duty cycles and period.

Here is what I get with the code below (500Hz, duty cylce 50%) with the code attached. Do you now why I get this and how to fix it ?
Thanks !

[Image

Code:

#include "ets_sys.h"
#include "osapi.h"
#include "pwm.h"
#include "os_type.h"

#define NB_PWM_CHANNELS  1u          // Nb of PWM channel to be active

void user_init()
{   
    uint32 period = 2000;                      // PWM period in microsec (mini is 1000, max 10000)
    uint32 nbChannels = NB_PWM_CHANNELS;       // Nb of PWM channel to be active
    uint32 duty[NB_PWM_CHANNELS] = {22222};    // Duty cycle, in number of step of 45ns
    uint32 pinParams[NB_PWM_CHANNELS][3] = {{PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14, 14u}};
   
    pwm_init(period, duty, nbChannels, pinParams);
    pwm_start();
}

Statistics: Posted by Pato — Tue Jun 26, 2018 6:35 pm


]]>