This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf52 DK try to set duty to 0 but i still could get about 400mv of LED

Dears:

I try to use nRF52_SDK_0.9.0_0c82e3e SDK pheripheral pwm example and set the channel1(led2)

duty to 0.

But i still could get the signal about 400mv with LED2(P0.18).

Would that be normal??

In my opinion it should 0v when i set the duty to 0.

Would i miss anything??

Please correct me if i am wrong.

Thanks for your command.

  • Hi Justin

    On my side, when testing this with nRF52-DK preview board (PCA10036), pwm example from nRF52 SDK 0.9.2, the voltage is 0.0V on both pin P0.17 and P0.18 when I set the duty cycle as follows:

    int main(void)
    {
    		ret_code_t err_code;
    		
    		/* 2-channel PWM, 200Hz, output on DK LED pins. */
    		app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(5000L, BSP_LED_0, BSP_LED_1);
    		
    		/* Switch the polarity of the second channel. */
    		pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
    		
    		/* Initialize and enable PWM. */
    		err_code = app_pwm_init(&PWM1,&pwm1_cfg,pwm_ready_callback);
    		APP_ERROR_CHECK(err_code);
    		app_pwm_enable(&PWM1);
    		
    		app_pwm_channel_duty_set(&PWM1, 0, 0);
    		app_pwm_channel_duty_set(&PWM1, 1, 100);
    	
    		uint32_t value;
    		while(true)
    		{
    		} 
    }
    
  • Dear Stefan:

    Thanks for your quickly reply. I try to use nRF52 SDK 0.9.2 and use the example as above on my DK(PCA10040). And I still could get the 400mv on BSP_LED_1 and 2.87v on the BSP_LED_0. As i know if we set the pin to Active_high. Set duty to 0 it should reply 0v and set duty to 100 will reply 2.87v. If we set the pin Active low. Set duty to 0 it should reply 2.87v and set duty to 100 will reply 0v. If i am wrong please correct me. I try to just config one channel PWM. The result is the same. It looked like i coulne't set the pin to 0v. Would you please give some command or hint?? Thanks a lot.

  • That is strange.

    Make sure you do not have anything connected to those pins.

    Make sure your multimeter has a new battery. Some multimeters give false results when battery is low.

    Try also to configure other pins than P0.17 and P0.18 to the PWM and measure if you get the correct voltage on them. It is a possibility that internal ESD diodes are shorted on certain pins, depending on your previous activity with your board.

  • Dear Stefan:

    I try to use P0.31 and P0.22 for testing.

    It could normal config as i expect.

    And i try both P0.17 P0.18 P0.19 and P0.20 all of them are abnormal.

    It might be the some hardware reason.

    I will check it.

    Thanks for your great help.

    BR, Justin

Related