Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

No gpio on BPI M4-zero

Featured Replies

Looking at the new BPI M4 zero to replace a RPI zero. The official build listed does not have gpio turned or maybe just not built into the kernel. If I download the image from the BPI website it has it but it based on bullseye and the image is broke. I built my own image but still no go so I am not sure what is wrong. I have built images for other boards and projects with success so that's not the problem.

 

I have a 3.5" TFT touch screen and some relays that I need to run along with a sensor.

On 11/20/2024 at 9:31 AM, Igor said:

Take a look at universal projects that are made far better, and are universal by design.

 

Are you saying the repo I posted is low quality because it doesn't contain a ton of extra code for boards I'm not using? I can remove it for you if you disapprove.

29 minutes ago, iGNUiCould said:

for boards I'm not using?

 

When you cloned our repo, you got 10 years of specific work on common work and that was contributed by 500+ people. Most of people are resolving their specific problems, yes, but we all try to do it the way that is reusable, that person behind has less work. We also got a lot of things prepared. Doing things universal should always be considered. Also because you might get help from someone. Which has absolutely same problems, but is having hardware from another vendor.

 

In our world, SoC defines how things work, not the one that put SoC on PCB and name / sell it. This means that most of the drivers are the same, especially this area is shared - low level communication protocols such as GPIO, I2C, SPI. This is always shared among boards with the same SoC. This goes further. It is shared among same families and we also already have some common generic top level API / libraries that can be used. https://docs.kernel.org/driver-api/gpio/consumer.html (but here my understanding ends, I am not updated with the state of this)

 

36 minutes ago, iGNUiCould said:

Are you saying the repo I posted is low quality

 

Yes, it has no point poking into. WiringPi library is a dead project for many years and its no point dealing with this. What vendors do here is, trying to be "as Rpi as possible", so they are doing their quick and dirty assemblies of that, always with partial functionality and absolute absence of maintenance. Their goal is to sell, regardless what is the quality of software. Is that your goal? I doubt.

I am not an expert in this field, so those are general tips, but there are people on and around this forum that knows this stuff well, as they developed those libraries.

 

41 minutes ago, iGNUiCould said:

I can remove it for you if you disapprove.

 

I am just giving you some ideas / tips. Decision what you will do with your time is yours.


Another one that came into my mind, while replying: https://github.com/eclipse/mraa

Hi all, what's the current state? Is GPIO supported "out-of-the-box" installing armbian?
I'm searching for a GPIO enabled raspi-like with EMMC onboard and BPI M4 zero check that box. Don't need HDMI.

 

ty

33 minutes ago, jscax said:

Is GPIO supported "out-of-the-box"


This is my script:

 

#!/bin/bash
task(){
	gp=$1
        [[ ! -d /sys/class/gpio/gpio${gp} ]] && echo ${gp} > /sys/class/gpio/export
        echo "out" > /sys/class/gpio/gpio${gp}/direction
        echo "0" > /sys/class/gpio/gpio${gp}/value
        sleep 10
        echo "1" > /sys/class/gpio/gpio${gp}/value

}

 

for doing this:

https://www.youtube.com/watch?v=HxZ_FD5b5QQ

on a very similar board:

 

Linux nanopim1 5.15.93-sunxi


installed nothing extra.

On 1/24/2025 at 6:46 AM, jscax said:

Hi all, what's the current state? Is GPIO supported "out-of-the-box" installing armbian?
I'm searching for a GPIO enabled raspi-like with EMMC onboard and BPI M4 zero check that box. Don't need HDMI.

 

Works for me... 
 

image.png.9b1769733a74ad2be8a37d0e3a478261.png

 

Here's some code that uses it to get the readings from a DHT11 sensor.

 

/*
 * temphumid.c:
 *	Read Temperature / Humidity from DHT11 sensor
 *  -iGNUiCould
*/

#include <wiringPi.h>
#include <stdio.h>

#define MAX_TIMINGS 85
#define DHTPIN 7 // GPIO pin for DHT11 data

int data[5] = {0, 0, 0, 0, 0};

// Function to read data from DHT11
void readDHT11() {
    uint8_t lastState = HIGH;
    uint8_t counter = 0;
    uint8_t j = 0, i;

    data[0] = data[1] = data[2] = data[3] = data[4] = 0;

    // Send start signal to DHT11
    pinMode(DHTPIN, OUTPUT);
    digitalWrite(DHTPIN, LOW);
    delay(18);
    digitalWrite(DHTPIN, HIGH);
    delayMicroseconds(40);
    pinMode(DHTPIN, INPUT);

    // Read data from DHT11
    for (i = 0; i < MAX_TIMINGS; i++) {
        counter = 0;
        while (digitalRead(DHTPIN) == lastState) {
            counter++;
            delayMicroseconds(1);
            if (counter == 255) {
                break;
            }
        }
        lastState = digitalRead(DHTPIN);

        if (counter == 255) {
            break;
        }

        // Ignore first 3 transitions
        if ((i >= 4) && (i % 2 == 0)) {
            data[j / 8] <<= 1;
            if (counter > 16) {
                data[j / 8] |= 1;
            }
            j++;
        }
    }

    // Verify checksum and print data if valid
    if ((j >= 40) &&
        (data[4] == ((data[0] + data[1] + data[2] + data[3]) & 0xFF))) {
        float humidity = data[0] + data[1] / 10.0;
        float tempC = data[2] + data[3] / 10.0;
        float tempF = tempC * 9.0 / 5.0 + 32;

        printf("Temperature = %.1f°F\n", tempF);
        printf("Humidity = %.1f%%\n", humidity);
    } else {
        printf("Data not valid\n");
    }
}

int main() {
    if (wiringPiSetup() == -1) {
        printf("WiringPi setup failed\n");
        return -1;
    }

    while (1) {
        readDHT11();
        delay(2000); // Wait 2 seconds before reading again
    }

    return 0;
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.