This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM signal was reversed.

I using github code. SDK is 7.0.1 SD : S110 7.1.0

Channel : 4 ch

Period : 20ms

Width : 1-2ms ( RC )

Sometimes the width operates at 18-19ms.

ex : PWM2 was reversed. image description

Init code:

void _init(void) {

nrf__config_t _config = _DEFAULT_CONFIG;

_config.mode             = _MODE_RC_5000;
_config.num_channels     = 4;
_config.gpio_num[0]      = 26;
_config.gpio_num[1]      = 17;
_config.gpio_num[2]      = 9;
_config.gpio_num[3]      = 12;

// Initialize the  library
nrf__init(&_config);


nrf__set_value(0, 1500);
nrf__set_value(1, 1500);
nrf__set_value(2, 1500);
nrf__set_value(3, 1500);

}

output code :

{ if(_out[0] >= 2000) _out[0] = 2000; if(_out[0] < 1000) _out[0] = 1000;

nrf__set_value(0, _out[0] );

}

I attached my code. nrf_.c

nrf_.h

Parents
  • Hi

    The latest revision of the nRF51x22 has a issue that affects PWM if you use powerdown, and it might be this issue causing the PWM inverting.

    Fortunately a workaround exists, and I will try to update the PWM driver today to implement it.

    Can you confirm if you are using power down, and also what revision of the nRF51x22 you have?

    UPDATE: Sorry for the slow response, I was caught up in other things. Can you please try the attached file and see if it works better? nrf_pwm.c

    It now adds the workaround for the timer issue introduced in revision 3 (and explained in the nRF51x22 PAN).

    If you can confirm that it solves the issue I will also push an update to the repository.

    Regards Torbjørn

Reply
  • Hi

    The latest revision of the nRF51x22 has a issue that affects PWM if you use powerdown, and it might be this issue causing the PWM inverting.

    Fortunately a workaround exists, and I will try to update the PWM driver today to implement it.

    Can you confirm if you are using power down, and also what revision of the nRF51x22 you have?

    UPDATE: Sorry for the slow response, I was caught up in other things. Can you please try the attached file and see if it works better? nrf_pwm.c

    It now adds the workaround for the timer issue introduced in revision 3 (and explained in the nRF51x22 PAN).

    If you can confirm that it solves the issue I will also push an update to the repository.

    Regards Torbjørn

Children
Related