Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4474

SDK • GPIO_PUT not working

$
0
0
I have a problem when I was trying to set a pin as chip select for a nand flash chip.
GPIO 9

But when I use gpio_put(9, 1) the value remains at 0(low).

I tried with another random pin 20 and same behavior.
What am I doing wrong?

```C
init_pin(20);
print_pin(20);
set_pin(20, 1);
print_pin(20);
sleep_ms(1);
print_pin(20);

void print_pin(uint gpio)
{
if(gpio_get(gpio))
{
printf("GPIO 1\n");
}
else
{
printf("GPIO 0\n");
}
}

void init_pin(uint gpio)
{
gpio_init(gpio);
}

void set_pin(uint gpio, bool value)
{
gpio_put(gpio, value);
}
```
The output is:
```
GPIO 0
GPIO 0
GPIO 0
```

Other environmental factors done earlier in code:
set_sys_clock_48mhz()
cyw43_set_pio_clock_divisor(1, 0);

Statistics: Posted by gooblue — Wed Nov 13, 2024 4:22 am — Replies 1 — Views 41



Viewing all articles
Browse latest Browse all 4474

Trending Articles