Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pwm waveshape unstable every few second after setup a small duty value(5% etc) #2

Open
skcks opened this issue Feb 24, 2018 · 16 comments

Comments

@skcks
Copy link

skcks commented Feb 24, 2018

when setup a small duty value(5% etc) , pwm waveshape become unstable every few second. how to solve this problem?

@nochkin
Copy link
Owner

nochkin commented Feb 24, 2018

Could be a bug. The code is new.
I don't have a logic analyzer to check it. Can you please provide screenshots?

@skcks
Copy link
Author

skcks commented Feb 24, 2018

the same problem exist in newpwm, it could be detect by using oscilloscope .

@nochkin
Copy link
Owner

nochkin commented Feb 24, 2018

The "newpwm" is not my code, I can't say anything for it. The "multipwm" is not related to it.
Can you please provide a screenshot of the distortion you saw?

@skcks
Copy link
Author

skcks commented Feb 24, 2018

ok, I will post the screenshot of oscilloscope later.

@skcks
Copy link
Author

skcks commented Feb 24, 2018

Screenshot from oscilloscope :
dist

run test in my project, my project use some COMPONENTS defined in Makefile

EXTRA_COMPONENTS = $(abspath ./components/cjson) \
		extras/spiffs \
		extras/onewire \
                extras/ds18b20 \
		extras/sntp \
		extras/mdnsresponder \
		extras/mbedtls \
		extras/httpd

some code used multipwm, always get freq 76Hz ignored PWM_FREQ

        #define PWM_FREQ 500

        ....

        multipwm_init(&pwm_info);
	multipwm_set_freq(&pwm_info, PWM_FREQ);

	for (int i = 0; i < pin_count; i++) {
		multipwm_set_pin(&pwm_info, i, pins[i]);
	}

	BR_LOGI(TAG, "gpio setup finish\n");

	multipwm_start(&pwm_info);

2

@nochkin
Copy link
Owner

nochkin commented Feb 24, 2018

Great. Thank you for the screenshots.
Seems like something else is taking the interrupt resources and that breaks things. I'll try to get a hold for a logic analyzer so I could debug it.
Meanwhile, is it possible to minimize your project to see if another library may cause the conflict? I know printf's may distort it so if you could temporary remove/comment it, then would be a good test too.

@skcks
Copy link
Author

skcks commented Feb 25, 2018

run examples/multipwm_test.c is unstable also, the pwm wave delay. the freq become 1.3khz.
dist-ex

@nochkin
Copy link
Owner

nochkin commented Feb 25, 2018

Thanks for checking and providing the relevant information. I'll take another look when I get the logic analyzer so I can debug the issue.
I have some ideas.

@nochkin
Copy link
Owner

nochkin commented Mar 14, 2018

Sorry for delay. I got my logic analyzer and was able to replicate the issue more or less.
I believe I fixed the issue. I just need more testing to make sure this works well.

I will keep you updated. Stay tuned, don't go too far.

@skcks
Copy link
Author

skcks commented Mar 15, 2018

@nochkin god job!!!

@xfce
Copy link

xfce commented Apr 30, 2018

does this function OK now?

@nochkin
Copy link
Owner

nochkin commented Apr 30, 2018

@xfce,
Besides setting the frequency, it works.
I could not exactly replicate the issue, but at least I know this is related to setting a new frequency.

Unfortunately, investigation took much longer than expected due to limited tools I have. But I still plan to make it work.

@FelipeCrispim
Copy link

Hi,
I have downloaded the newest version, but I'm still facing that instability. I have tried to set the frequency, for example, to 1kHz but it didn't solve the instability...
What could I do?

@nochkin
Copy link
Owner

nochkin commented May 1, 2018

As I mentioned before, setting the frequency does not work. I need to fix that issue.
When I don't set the frequency at all, it works on things like normal motors, LEDs and simple things like that.

@SmartArduino
Copy link

does this function OK now?

@nochkin
Copy link
Owner

nochkin commented Oct 20, 2019

Most of the current development moved onto ESP32 now where PWM is part of the chip.
The original esp-open-rtos is not being actively supported due to this.

I believe if you don't see the frequency, the lib should still behave properly.
If you have PR for improvement, feel free to submit it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants