Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Wrong frequency #1

Closed
Closed
@americodias

Description

@americodias

Describe the bug

I'm getting wrong results.

Steps to Reproduce

I'm running a modified version of your PWM_Multi example on a Arduino Nano RP2040 Connect.

Expected behavior

9 kHz output

Actual behavior

I get 11.81kHz according to the oscilloscope.

However if I change the code to 10kHz for instance, I get 10kHz.

Debug log

Starting PWM_Multi on Nano RP2040 Connect
RP2040_PWM v1.0.0
=============================================================
Index	Pin	PWM_freq	DutyCycle	Actual Freq
=============================================================
0	4	9000.00		50[PWM] bestfit_PWM_Freq = 8999.28, PWM_Freq_diff = 0.72, Top_p_1 - 1 = 13889, vsDiv/16.0 = 1.00
[PWM] bestfit_PWM_Freq = 8999.93, PWM_Freq_diff = 0.07, Top_p_1 - 1 = 13888, vsDiv/16.0 = 1.00
[PWM] bestfit_PWM_Freq = 9000.01, PWM_Freq_diff = 0.01, Top_p_1 - 1 = 10581, vsDiv/16.0 = 1.31
[PWM] PWM_Freq = 9000.00, _actualFrequency = 9000.01, PWM_Freq_diff = 0.01
[PWM] TOP = 1DIV = 1
		9000.01
[PWM] 
TOP = 10581, DIV = 1, CPU_freq = 125000000
=============================================================

Screenshots

Oscilloscope screenshot here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions