How Port1 in NRF5340 can be activated

Hi

I am using nrs5340 chip as an SOC in my project. I want to use some Port1 Pins in my hardware design. As far as I studied in your Dev Zone, this

is inactive by default in nrf5340. I have seen some similar questions in the Dev Zone but I couldn't understand clearly how it could be activated.

I have written a very simple program and tried to toggle for example to toggle P1.01 in my code.

My code is attached below.

I would be very thankful if  you could help me in this regard.

Best regards

/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>


/
#define LED0_NODE DT_ALIAS(led0)
#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN DT_GPIO_PIN(LED0_NODE, gpios)
#define FLAGS DT_GPIO_FLAGS(LED0_NODE, gpios)

#else


#error "Unsupported board: led0 devicetree alias is not defined"
#define LED0 ""
#define PIN 0
#define FLAGS 0
#endif
*/
//#define SLEEP_TIME_MS 1000

#define led1 28 //pin number for led1
#define led2 29 //pin number for led2
#define led3 30 //pin number for led3
#define led4 31 //pin number for led4

#define pr1 45
#define pr0 13
void main(void)
{

const struct device *port0 = device_get_binding("GPIO_0"); //get the device address of port0
const struct device *port1 = device_get_binding("GPIO_1"); //get the device address of port1

gpio_pin_configure(port1,10,GPIO_OUTPUT_LOW);
gpio_pin_configure(port1,11,GPIO_OUTPUT_HIGH);

gpio_pin_configure(port0, sw1, GPIO_INPUT | 16); //set the pin for sw1 as input with pull up
gpio_pin_configure(port0, sw2, GPIO_INPUT | 16);
gpio_pin_configure(port0, sw3, GPIO_INPUT | 16);
gpio_pin_configure(port0, sw4, GPIO_INPUT | 16);

gpio_pin_configure(port0,led1,GPIO_OUTPUT_HIGH); //set the pin for led0 as output high
gpio_pin_configure(port0,led2,GPIO_OUTPUT_HIGH);
gpio_pin_configure(port0,led3,GPIO_OUTPUT_HIGH);
gpio_pin_configure(port0,led4,GPIO_OUTPUT_HIGH);


gpio_pin_configure(port1,pr1,GPIO_OUTPUT_HIGH);
gpio_pin_configure(port0,pr0,GPIO_OUTPUT_HIGH);

k_msleep(100);
while(1){


gpio_pin_set(port1,pr1,1);
k_msleep(100);
gpio_pin_set(port0,led1,1);
k_msleep(1000);
gpio_pin_set(port1,pr1,0);
k_msleep(100);
gpio_pin_set(port0,led1,0);
k_msleep(1000);
}

}

Related