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.

  • I took your main file and compiled today ... i have no idea what you are trying to do? The main function should end with while(1){}; .. this is an embedded platform and the main function cannot return. Also your printfs are used before even initializing uart.

    You were using app timer with one shot, so you need not cancel the app_timer_2_sec when you release the button.

    I am uploading the main file that i tested in SDK10. After pressing the button, and i verified that it works with pin 6 as pwm signal.

    NOTE: The side effect of using the same button to detect on and off with timer is that. When you press the button for 3 seconds, the pwm will start 2 with 2 seconds delay. When you press button for 5 seconds, the pwm will stop immediately. This is because the decision is taken after 5 seconds of the button push.

    main.c

    image description

Reply
  • I took your main file and compiled today ... i have no idea what you are trying to do? The main function should end with while(1){}; .. this is an embedded platform and the main function cannot return. Also your printfs are used before even initializing uart.

    You were using app timer with one shot, so you need not cancel the app_timer_2_sec when you release the button.

    I am uploading the main file that i tested in SDK10. After pressing the button, and i verified that it works with pin 6 as pwm signal.

    NOTE: The side effect of using the same button to detect on and off with timer is that. When you press the button for 3 seconds, the pwm will start 2 with 2 seconds delay. When you press button for 5 seconds, the pwm will stop immediately. This is because the decision is taken after 5 seconds of the button push.

    main.c

    image description

Children
No Data
Related