Skip to content

K64F PwmOut - incorrect timing #2936

@BlackstoneEngineering

Description

@BlackstoneEngineering

Note: This is just a template, so feel free to use/remove the unnecessary things

Description

  • Type: Bug
  • Priority: Major

Bug

Target
K64F

meed-os sha:
(git log -n1 --oneline)
release 5.1.4

Problem

The PwmOut's on K64F are not behaving correctly. I used the following code

#include "mbed.h"

// Template to check Falling edge and Risign edge interrupts.
void main()
{
    PwmOut pwm(D3);
    pwm.period(0.5f);
    pwm.write(0.5f);

    while(1){;}
}

which you would expect to create a pwm wave with a period of 0.5s with a duty cycle of 50%. When measured the square wave had a frequency of 10.66ms.
Image of logic analyzer

This behavior holds when I increase the period to 1s, instead it goes to 20.33ms.

Solution?

Something is going wrong somewhere in the internal math. Haven't been able to find a solution yet.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions