hanzhi09
Posts: 1
Joined: Wed Sep 11, 2019 12:21 pm

Problem with GPIO Mode

Wed Sep 11, 2019 12:27 pm

I have set the GPIO pins 40, 41,42 as ALT4 mode with overlay.
[email protected] {
53 target = <&gpio>;
54 __overlay__ {
55 spi2_pins: spi2_pins {
56 /* miso mosi clock */
57 brcm,pins = <40 41 42>;
58 brcm,function = <3>;
59 brcm,pull = <BCM2835_PUD_OFF>;
60 };

But after booting, pin 40, 41 is as expected, but pin 42 (together with 43) is always IN mode, which should be same with pins 40,41 as ALT4.
[email protected]:~$ gpio readall
+-----+------+-------+ +-----+------+-------+
| Pin | Mode | Value | | Pin | Mode | Value |
+-----+------+-------+ +-----+------+-------+
| 0 | IN | High | | 27 | IN | Low |
| 1 | IN | High | | 28 | IN | Low |
| 2 | ALT0 | High | | 29 | IN | Low |
| 3 | ALT0 | High | | 30 | IN | Low |
| 4 | IN | High | | 31 | IN | High |
| 5 | OUT | Low | | 32 | IN | Low |
| 6 | IN | High | | 33 | IN | High |
| 7 | IN | High | | 34 | ALT3 | Low |
| 8 | OUT | High | | 35 | ALT3 | High |
| 9 | IN | Low | | 36 | ALT3 | High |
| 10 | IN | Low | | 37 | ALT3 | High |
| 11 | IN | Low | | 38 | ALT3 | High |
| 12 | IN | Low | | 39 | ALT3 | High |
| 13 | IN | Low | | 40 | ALT4 | High |
| 14 | ALT0 | High | | 41 | ALT4 | Low |
| 15 | ALT0 | High | | 42 | IN | Low |
| 16 | IN | Low | | 43 | IN | High |
| 17 | IN | Low | | 44 | ALT4 | High |
| 18 | IN | High | | 45 | ALT4 | High |
| 19 | IN | Low | | 46 | IN | High |
| 20 | IN | Low | | 47 | OUT | High |
| 21 | OUT | Low | | 48 | ALT0 | Low |
| 22 | IN | High | | 49 | ALT0 | High |
| 23 | IN | High | | 50 | ALT0 | High |
| 24 | IN | Low | | 51 | ALT0 | High |
| 25 | IN | Low | | 52 | ALT0 | High |
| 26 | IN | Low | | 53 | ALT0 | High |
+-----+------+-------+ +-----+------+-------+
Anybody has any ideas about this ?
thx in advance.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2489
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problem with GPIO Mode

Wed Sep 11, 2019 2:08 pm

Can I see the rest of your overlay? And which platform are you on?

Return to “Device Tree”