EVB on supports one GPIO Input, one GPIO Output and one GPIO Interrupt ... And names them sequentially: "/dev/gpio0", "/dev/gpio1", "/dev/gpio2" ... Which gets super confusing because "/dev/gpio0" doesn't map to BL602 GPIO Pin 0 🤔

github.com/lupyuen/bl602_expan

All 23 GPIOs are fully wired up on Stack ! 😲 Let's simplify and rename the GPIOs as "/dev/gpio0" to "/dev/gpio22" ... Easier for devs to create NuttX Drivers 👍

github.com/lupyuen/bl602_expan

Apache RTOS lets us create I/O Expander Drivers that will handle many GPIOs (Input / Output / Interrupt) ... Perfect for Stack !

github.com/lupyuen/bl602_expan

Handling GPIO Interrupts gets tricky on Stack ... All GPIO Interrupts are multiplexed into a single IRQ! Our GPIO Expander can help

github.com/lupyuen/bl602_expan

As noted (eloquently) by Robert Lipe, attaching a GPIO Interrupt Handler is hard (because our stars are misaligned) ... Let's fix this with our GPIO Expander for Apache RTOS

github.com/lupyuen/bl602_expan

Follow

Tracking all 23 GPIOs used by Stack can get challenging ... We might reuse GPIOs by mistake! 😱 Our GPIO Expander shall validate the GPIOs at startup

github.com/lupyuen/bl602_expan

Someday our GPIO Expander for shall validate that the SPI / I2C / UART Pin Functions are correctly assigned to the GPIO Pin Numbers ... So SPI MISO must be either GPIO 0, 4, 8, 12, 16 or 20

github.com/lupyuen/bl602_expan

Our GPIO Expander for implements these GPIO Operations: 1️⃣ Config / Read / Write GPIOs 2️⃣ Attach / Detach GPIO Interrupt Handlers 3️⃣ Handle GPIO Interrupts

github.com/lupyuen/bl602_expan

At Startup, our GPIO Expander configures each Input / Output / Interrupt GPIO ... And registers the GPIOs as "/dev/gpioN"

github.com/lupyuen/bl602_expan

Our GPIO Expander for RTOS will configure the GPIO Interrupts: Rising Edge Trigger vs Falling Edge Trigger

github.com/lupyuen/bl602_expan

GPIO Expander for calls the BL604 GPIO Driver to read GPIO Inputs and write GPIO Outputs ... Wonder what happens if we flip between Input and Output ... Like for Stack's Push Button / Vibrator 🤔

github.com/lupyuen/bl602_expan

How we attach a GPIO Interrupt Handler in our GPIO Expander for RTOS ... Only 1 Interrupt Hander per GPIO ... No Daisy Chaining for now 🌼⛓

github.com/lupyuen/bl602_expan

Managing 23 GPIOs on Stack gets messy ... Our new GPIO Expander for Apache RTOS can help! All shall be explained in this article

lupyuen.github.io/articles/exp

Show newer

@lupyuen

Can we static assert to avoid overheads in nuttx?
(Ie prevent builds with bad allocations)

@Ralim Hmmm maybe. But we still need a runtime check to be sure that the GPIOs are not reused

@lupyuen hmm true. I just like having configurations checked at compile time where possible to save iterations of testing :)

@lupyuen
Hmm…
If each pin can only be used once, could we flip the arrignment matrix and instead have it always have an entry for each pin, which is either a selected value or hi-z by default; then use kconfig rules to prevent collisions ?

(Not sure, haven't used this much tbqh)

@Ralim Hmmm major Kconfig Conflict between BL602 and ESP32 ... Wonder how the NuttX folks feel about this 🤔

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.