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

GPIOHigh Drive Mode is not working properly

Hello Everyone

I am trying to configure the two GPIO in High Drive mode 5mA but after compiling the program it does not seems like congifured to High drive Mode because the loudness of the buzzer is not increased so can anyone suggest me what went wrong in my GPIO configuration any ideas or suggestions will be helpful for me

main.c

Parents
  • app_pwm_init(...) is overwriting the gpio configuration to S0S1. Configure the gpio after app_pwm_init(...) instead. You are also setting the pin to input with:

    NRF_GPIO->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos);
    

    Since this will set all other bits than the drive config to zero. Change it to this:

    NRF_GPIO->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos)
                           |(GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
    

    With H0D1 you will not be able to source current as said in the comments, change to D0H1 or H0H1.

    Regarding the buzzer not being louder, it seems like the voltage is fairly high (2.9V). I guess Vcc is 3.3V? The sound may not get higher using PWM at 50%.

    I will suggest to use a transistor instead of gpio directly like I have said in another post. This is not only because of current draw, but also because the buzzer may cause a flyback voltage going into the nRF chip.

Reply
  • app_pwm_init(...) is overwriting the gpio configuration to S0S1. Configure the gpio after app_pwm_init(...) instead. You are also setting the pin to input with:

    NRF_GPIO->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos);
    

    Since this will set all other bits than the drive config to zero. Change it to this:

    NRF_GPIO->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos)
                           |(GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
    

    With H0D1 you will not be able to source current as said in the comments, change to D0H1 or H0H1.

    Regarding the buzzer not being louder, it seems like the voltage is fairly high (2.9V). I guess Vcc is 3.3V? The sound may not get higher using PWM at 50%.

    I will suggest to use a transistor instead of gpio directly like I have said in another post. This is not only because of current draw, but also because the buzzer may cause a flyback voltage going into the nRF chip.

Children
Related