config-pin and Using a new system w/ the BBGW boards made by __________

Hello,

I was wondering something. I will find out in time but is config-pin obsolete now w/ the Debian Bookworm images on the am335x processor styled boards?

Seth

1 Like

Hi, @silver2row.

Did you find your answer to this? I’m wondering the same thing. What do we use to configure pins if not config-pin in Debian 12 Bookworm?

Thanks

1 Like

@bibg ,

For now, my current image with kernel 5.10.x on the Bookworm Distro does not have config-pin.

Seth

P.S. Some source could make or break you. I have had some luck with building around the am335x still in specific periods.

@bibg ,

Hello…I think using file descriptors may help a bit. If something is an input, tell Linux to make it an output.

Seth

P.S. If that does not seem reasonably okay, try to use some available programming languages that are you familiar with currently. I think gpioinfo will be a good command to show off what is allocated to what…

Here:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define PWM_PERIOD 20000 
#define DUTY_MIN 1000
#define DUTY_MAX 2000

void writeToFile(const char* path, int value) {
        FILE* file = fopen(path, "w");
        if(file == NULL) {
                perror("Error opening file");
                printf("My integer is: %d\n", value);
                printf(path);
                exit(1);
        }
        fprintf(file, "%d", value);
        fclose(file);
}
int main(){
        writeToFile("/sys/class/pwm/pwm-0:0/enable", 1);
        writeToFile("/sys/class/pwm/pwm-0:0/period", PWM_PERIOD);
        while(1){
                
                // Move the servo to the left (minimum position)
                writeToFile("/sys/class/pwm/pwm-0:0/duty_cycle", DUTY_MIN);
                usleep(2000000);

                // Move the servo to the right (maximum position)
                writeToFile("/sys/class/pwm/pwm-0:0/duty_cycle", DUTY_MAX);
                usleep(2000000);

                // Move the servo to the center position 
                writeToFile("/sys/class/pwm/pwm-0:0/duty_cycle", (DUTY_MIN + DUTY_MAX) / 2);
                usleep(2000000);
        }
        writeToFile("/sys/class/pwm/pwm-0:0/enable", 0);

        return 0;
}

That source does not work nor is it supposed to work currently on the BBB or BBGW am335x style of boards from beagleboard.org.

But!

instead of /sys/class/pwm/*, use /dev/bone/pwm/* and you will find glory. And that humbug about the input already being an input and it showing as an input business, that is what I was discussing.

You can use source to change the input as input to an output for usage even if a said GPIO is input.

Seth

Thanks so much Seth! I’ll try this soon.

1 Like