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

How to configure Port 1 pin in nrf52833 DK board?

I want to configure port1 pin 8 as output pin but it wont work

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"


#define led0 NRF_GPIO_PIN_MAP(1,8)               // LED0 P1.8
 
/**
 * @brief Function for application main entry.
 */
int main(void)
{
    nrf_gpio_cfg_output(led0); // config the as output pin

    while(1)
    {

          nrf_gpio_pin_toggle(led0);
          nrf_delay_ms(1000);

    }
}

Parents
  • Hi,

    I tested your code on a nRF52833 DK and verified with a logic analyzer that P1.08 pin is toggling correctly.

    Do you have anything connected to the pin, or some other code in your application that could configure the pin for use with some other peripheral?

    Best regards,
    Jørgen

  • Hi Jorgen

    After your inputs I check and modified my code for different pins also,but on port 1 i didnt find any output.I share the code and logic analyser result for port 0 and port 1.For port 0 I get the output but not for port 1port 0-ch1 & port 1 ch2

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "nrf_gpio.h"
    
    
    #define led0 NRF_GPIO_PIN_MAP(0,13)
    #define led1 NRF_GPIO_PIN_MAP(1,8)                 // LED0 P1.8
     
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        nrf_gpio_cfg_output(led0); // config the as output pin
        nrf_gpio_cfg_output(led1); // config the as output pin
    
    
        while(1)
        {
    
              nrf_gpio_pin_toggle(led0);
              nrf_delay_ms(500);
              nrf_gpio_pin_toggle(led1);
              nrf_delay_ms(500);
    
        }
    }

Reply
  • Hi Jorgen

    After your inputs I check and modified my code for different pins also,but on port 1 i didnt find any output.I share the code and logic analyser result for port 0 and port 1.For port 0 I get the output but not for port 1port 0-ch1 & port 1 ch2

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "nrf_gpio.h"
    
    
    #define led0 NRF_GPIO_PIN_MAP(0,13)
    #define led1 NRF_GPIO_PIN_MAP(1,8)                 // LED0 P1.8
     
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        nrf_gpio_cfg_output(led0); // config the as output pin
        nrf_gpio_cfg_output(led1); // config the as output pin
    
    
        while(1)
        {
    
              nrf_gpio_pin_toggle(led0);
              nrf_delay_ms(500);
              nrf_gpio_pin_toggle(led1);
              nrf_delay_ms(500);
    
        }
    }

Children
No Data
Related