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

button exmaple is not working in SDK version 9.0.0

Hello evryone,

i cloned button example form github to sdk version 9.0.0 and i modified the neccesary changes between app.gpiote.c//nrf_drv_gpiote.c files and set the GPIOTE ENABLED to 0 after that it is getting compiled with no errors but the baord shows nothing if the press any of the button can anyone suggest me what modifications has to be done or any changes?

ble_app_template.zip

Thank you

prabhu

Parents
  • Hi prabhudurai,

    still havent gone through your code, but had a quick look. I saw this below code in your init_gpio() function

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

    This is wrong as you are setting every other bits to '0' and only setting the drive strength. With this the pin will be configured as input. To do this correctly, you need to do this below

    NRF_GPIO->PIN_CNF[6] &= ~(GPIO_PIN_CNF_DRIVE_Msk); // reset drive setting
    NRF_GPIO->PIN_CNF[6] |= (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos); // set to high drive
    

    you need to do this for pin settings 7 also.

Reply
  • Hi prabhudurai,

    still havent gone through your code, but had a quick look. I saw this below code in your init_gpio() function

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

    This is wrong as you are setting every other bits to '0' and only setting the drive strength. With this the pin will be configured as input. To do this correctly, you need to do this below

    NRF_GPIO->PIN_CNF[6] &= ~(GPIO_PIN_CNF_DRIVE_Msk); // reset drive setting
    NRF_GPIO->PIN_CNF[6] |= (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos); // set to high drive
    

    you need to do this for pin settings 7 also.

Children
  • Thanks ARYAN for your kind reply i have modified the gpio configuration based on your suggestion both the gpio pin 6 and pin 7 are output pins which are connected to the buzzer terminal and i ahve connected individually buzzer to pin 6 and 7 inorder to test only pin6 making the buzzer beep but the pin 7 does not make the buzzer beep but it is showing voltage across th pin is 2.9V i dont understand why this issue arising

  • have you changed this for pin 7 also?

    NRF_GPIO->PIN_CNF[7] &= ~(GPIO_PIN_CNF_DRIVE_Msk); // reset drive setting
    NRF_GPIO->PIN_CNF[7] |= (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos); // set to high drive
    

    I tested your code on my desk and it works fine on both pin 6 and pin 7.

  • really i have connected the buzzer sperately for both pins but only one pin is making beep sound that too it is not loud enough and also i have one question does the buzzer make beep sound after pressing the button ? because am trying to make that function like that and also pin 6 ,pin7 collectively provides 5mA current because am not gettign that function working properly

  • sorry, I have no buzzer, i have connected them to LED_! and LED_2 and they are glowing bright. Buzzers are different with different current consumption and loudness. So I cannot comment on how they should perform. With LEDs i can confirm that the code logic is now OK for buzzer.

    I have also verified that if i press BUTTON1 for 3 seconds then LED3 glows and if i press button2 for 3 seconds then LED3 turns off. So your timers are also working fine.

  • yes thank you can you send me the code that you have tested because button part is working separtely and pwm part is working sepately when i press the button 3 sec only LED 1 is blinking and when i press the button for 5sec led 1 is turned off but it is not interfacing with the pwm am trying to make the buzzer beep after the button is pressed for three seconds did my program is correct for performing this function please let me know about this point

    Thank you