# Gpio not allocated with ADC hat

**URL:** <https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333>\
**Category:** General\
**Created:** [22 August 2024 14:36 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333 "2024-08-22T14:36:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpadie](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpadie/32/87036_2.png) [@jpadie](https://discourse.nodered.org/u/jpadie)\
**Post date:** [22 August 2024 14:36 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/1 "2024-08-22T14:36:54Z")

</div>

Hi  
I am using a waveshare adc hat with an ADS1256 chip that used SPI. ([Board info here](https://www.waveshare.com/18983.htm))

i'm getting inconsistent results from this - sometimes the Pi says gpio not allocated and sometimes there's just a generic comms failure and sometimes it just works. there's no logical difference between each state that I can see.

the error I'd like help debugging is this one

`lgpio.error: 'GPIO not allocated'`

When I check gpioinfo i get the following

```auto
gpiochip0 - 58 lines:
	line 0: "ID_SDA" unused input active-high 
	line 1: "ID_SCL" unused input active-high 
	line 2: "GPIO2" unused input active-high 
	line 3: "GPIO3" unused input active-high 
	line 4: "GPIO4" unused input active-high 
	line 5: "GPIO5" unused input active-high 
	line 6: "GPIO6" unused input active-high 
	line 7: "GPIO7" "spi0 CS1" output active-low [used]
	line 8: "GPIO8" "spi0 CS0" output active-low [used]
	line 9: "GPIO9" unused input active-high 
	line 10: "GPIO10" unused input active-high 
	line 11: "GPIO11" unused input active-high 
	line 12: "GPIO12" "lg" input active-high [used pull-up]
	line 13: "GPIO13" unused input active-high 
	line 14: "GPIO14" unused input active-high 
	line 15: "GPIO15" unused input active-high 
	line 16: "GPIO16" unused input active-high 
	line 17: "GPIO17" "lg" output active-high [used bias-disabled]
	line 18: "GPIO18" unused output active-high 
	line 19: "GPIO19" unused input active-high 
	line 20: "GPIO20" unused input active-high 
	line 21: "GPIO21" unused input active-high 
	line 22: "GPIO22" "lg" output active-high [used bias-disabled]
	line 23: "GPIO23" unused input active-high 
	line 24: "GPIO24" unused input active-high 
	line 25: "GPIO25" unused input active-high 
	line 26: "GPIO26" unused input active-high 
	line 27: "GPIO27" "lg" output active-high [used bias-disabled]
	line 28: "RGMII_MDIO" unused input active-high 
	line 29: "RGMIO_MDC" unused input active-high 
	line 30: "CTS0" unused input active-high 
	line 31: "RTS0" unused input active-high 
	line 32: "TXD0" unused input active-high 
	line 33: "RXD0" unused input active-high 
	line 34: "SD1_CLK" unused input active-high 
	line 35: "SD1_CMD" unused input active-high 
	line 36: "SD1_DATA0" unused input active-high 
	line 37: "SD1_DATA1" unused input active-high 
	line 38: "SD1_DATA2" unused input active-high 
	line 39: "SD1_DATA3" unused input active-high 
	line 40: "PWM0_MISO" unused input active-high 
	line 41: "PWM1_MOSI" unused input active-high 
	line 42: "STATUS_LED_G_CLK" "ACT" output active-high [used]
	line 43: "SPIFLASH_CE_N" unused input active-high 
	line 44: "SDA0" unused input active-high 
	line 45: "SCL0" unused input active-high 
	line 46: "RGMII_RXCLK" unused input active-high 
	line 47: "RGMII_RXCTL" unused input active-high 
	line 48: "RGMII_RXD0" unused input active-high 
	line 49: "RGMII_RXD1" unused input active-high 
	line 50: "RGMII_RXD2" unused input active-high 
	line 51: "RGMII_RXD3" unused input active-high 
	line 52: "RGMII_TXCLK" unused input active-high 
	line 53: "RGMII_TXCTL" unused input active-high 
	line 54: "RGMII_TXD0" unused input active-high 
	line 55: "RGMII_TXD1" unused input active-high 
	line 56: "RGMII_TXD2" unused input active-high 
	line 57: "RGMII_TXD3" unused input active-high

```

the pins that are used (or should be) are the standard SPI pins (GPIO9-11), a ready alert (GPIO7), a reset on gpio18 and the chip select on gpio 22..

the library ([here](https://flows.nodered.org/node/node-red-contrib-waveshare-shield-adda-11010) appears to have the right pin allocations and the config python file should set the pin allocations correctly. but somehow I'm getting the "not allocated" error and cant see why not!

can anyone shed any light or recommend a better behaved ADC hat?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 August 2024 14:57 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/2 "2024-08-22T14:57:32Z")

</div>

How are you accessing it from node red?

---

<div class="post-metadata">

**Author:** ![jpadie](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpadie/32/87036_2.png) [@jpadie](https://discourse.nodered.org/u/jpadie)\
**Post date:** [22 August 2024 15:14 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/3 "2024-08-22T15:14:11Z")

</div>

using the node package that I linked to (I referenced it as the library, but it is both a palette node and lib in fact)

---

<div class="post-metadata">

**Author:** ![jpadie](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpadie/32/87036_2.png) [@jpadie](https://discourse.nodered.org/u/jpadie)\
**Post date:** [22 August 2024 15:25 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/4 "2024-08-22T15:25:20Z")

</div>

I should add that this is on an RPi4b with bookworm installed.  
spidev is installed and spi enabled in raspi-config.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 August 2024 15:34 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/5 "2024-08-22T15:34:47Z")

</div>

When you linked and said it was a library I assumed that was a python library or similar rather than a node red node.

I think there were changes for gpio access via bookworm so it may be that the node needs updating.

You could try contacting the author for help via its gitlab page [Spring City Solutions LLC / waveshare-shield-adda-11010 · GitLab](https://gitlab.com/SpringCitySolutionsLLC/waveshare-shield-adda-11010)

---

<div class="post-metadata">

**Author:** ![jpadie](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpadie/32/87036_2.png) [@jpadie](https://discourse.nodered.org/u/jpadie)\
**Post date:** [22 August 2024 15:43 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/6 "2024-08-22T15:43:22Z")

</div>

apologies - it was both the lib and the node.

i don't think it is a lib compat issue. my working guess at the moment is that another palette node that uses python is leaving a zombie process and keeping the gpio allocations. deleting other gpio related nodes from the editor resolves the "not allocated" error and now leaves me with a library error stating that there is a ID Read fail. which translates to a communication issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 November 2024 15:44 UTC](https://discourse.nodered.org/t/gpio-not-allocated-with-adc-hat/90333/7 "2024-11-20T15:44:05Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
