I am using the nRF52840 dongle and am seeing problems when I try to use port 1 pins.
For instance, if I try to write to pin P1.01,
gpio_pin_set(dev, 32, 1);
I see this error
ASSERTION FAIL [(cfg->port_pin_mask & (gpio_port_pins_t)(1UL << (pin))) != 0U] @ WEST_TOPDIR/zephyr/include/drivers/gpio.h:750
[00:00:04.584,503] <err> os: r0/a1: 0x00000004 r1/a2: 0x000002ee r2/a3: 0x00000001
[00:00:04.584,533] <err> os: r3/a4: 0x00013b0a r12/ip: 0x2000124c r14/lr: 0x000023c9
[00:00:04.584,533] <err> os: xpsr: 0x61000000
[00:00:04.584,564] <err> os: Faulting instruction address (r15/pc): 0x00010570
[00:00:04.584,564] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:00:04.584,564] <err> os: Current thread: 0x200012e0 (unknown)
[00:00:04.635,345] <err> fatal_error: Resetting system
I seem to be able to write to pins on port 0, i.e. pins with a number less than 32 but unable to write above 32.
How do I enable this?
So it looks like you should use GPIO_1, not PORT_1. My mistake, I was thinking gpio port 1 in my head.
Also have in mind that "pin32" is actually the first pin on gpio1. So to control pin32 you need to…
I guess pin32 belong to port1, so I suspect you need to also use device_get_binding(PORT1).
Yes, its port P1.01. Sorry, I don't quite follow your explanation. Please can you tell me how I can write to this pin?
I suspect 'dev' in 'gpio_pin_set(dev, 32, 1);' is obtained by 'dev = device_get_binding(PORT0)', while you need to use 'dev = device_get_binding(PORT1)'.
I was actually using the following
#define LED0_NODE DT_ALIAS(led0)
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
dev = device_get_binding(LED0)
Whats the equivalent for setting/using PORT1?
Don't 'dev = device_get_binding(PORT1)' work?