-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Good morning,
I've been struggling for the past couple of days after my company requested a switch from 32-bit to 64-bit systems. Certain GPIO pins were not functioning no matter what I tried. After extensive debugging, I discovered the problem: the setR(...) function was not setting the pull resistor as expected. This caused the GPIO pins to fail unless the resistor was explicitly set to PULL_UP in our configuration. The pins worked correctly when the pull-up resistor was configured using the raspi-gpio set 10 pu command.
This issue pertains to the Raspberry Pi 4B with the BCM2711 GPIO chip and occurs under Debian 11 Bullseye. Don't know if the issue is related to other chips and OS.
C function that starts but fails to complete the task:
Lines 775 to 795 in c9b7598
| void gpio_enable_pud(uint8_t pin, uint8_t value) { | |
| if(value == 0){ | |
| *GPIO_GPPUD = 0x0; // Disable PUD/Pull-UP/Down | |
| } | |
| else if(value == 1){ | |
| *GPIO_GPPUD = 0x1; // Enable PD/Pull-Down | |
| } | |
| else if(value == 2){ | |
| *GPIO_GPPUD = 0x2; // Enable PU/Pull-Up | |
| } | |
| else{ | |
| printf("%s() error: ", __func__); | |
| puts("Invalid pud value."); | |
| } | |
| uswait(150); /* required wait times based on bcm2835 manual */ | |
| setBit(GPIO_GPPUDCLK0, pin); | |
| uswait(150); /* required wait times based on bcm2835 manual */ | |
| *GPIO_GPPUD = 0x0; | |
| clearBit(GPIO_GPPUDCLK0, pin); | |
| } |
Reference to a similar function in raspi-gpio (specific to the BCM2711, though other chip variations exist):
Metadata
Metadata
Assignees
Labels
No labels