raspberrypi / firmware

This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.
5.18k stars 1.68k forks source link

Default pin pull state upon boot #487

Closed industrial-pi closed 6 years ago

industrial-pi commented 9 years ago

I am evaluating the use a Raspberry Pi Model B+ v1.2 board in an industrial control system. I am perfectly able to control all the pin pullups and pulldowns from userspace (I have verified all with an oscilloscope) however this does not help me.

In particular, I need to disable the pullup on GPIO17 which is connected to a hardware watchdog circuit in my application. The pin must float, with no more than 10 uA leakage current, until it first drives the watchdog. The 50-60 kOhm internal pullup is enough to drive more than 3 times the allowed leakage current.

After driving the pin with more than 10 uA for the first time, the Pi must contine toggling it faster than 10 Hz to prevent the watchdog circuit from triggering an alarm, leaving no time to boot and start a toggling process from userspace.

The board runs raspbian and raspberrypi-bootloader version 1.20150923-1 straight out of the repository.

I have unsuccesfully tried changing the default pullup resistor state of GPIO17 by following the dt-blob method described at the following link.

https://www.raspberrypi.org/documentation/configuration/pin-configuration.md

Could you please let me know if the article above is still current and if there is any diagnostic messaging that can be enabled to allow troubleshooting this.

Some more information: I read in the BCM2835 ARM peripherals datasheet (page 100, GPIO Pull-up/down register GPPUD) that "the pullups are maintained even in power-down mode when the core is off, when all register content is lost". And if I disable the pullup from userland, and issue a sudo reboot command, the pull stays in the last state (as expected) until the next cold boot.

Another piece of information is that I am unable to change the deafult pull state to down as well as off. In other words, after a cold boot the pull is always up.

I really like the raspberry and it's a perfect fit for our application, however I'll have to drop it unless I can disable the pull upon boot.

I added just one line, then compiled it with dtc and put the resulting dt-blob.bin under /boot

pin@p17 { function = "input";  termination = "no_pulling"; }; // Watchdog

The complete dt-blob.dts source follows

/dts-v1/;

/ {
   videocore {
      pins_rev1 {
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p2  { function = "i2c1";   termination = "pull_up"; }; // I2C 1 SDA
            pin@p3  { function = "i2c1";   termination = "pull_up"; }; // I2C 1 SCL
            pin@p5  { function = "output"; termination = "pull_down"; }; // CAM_LED
            pin@p6  { function = "output"; termination = "pull_down"; }; // LAN NRESET
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p16 { function = "output"; termination = "pull_up"; polarity="active_low"; }; // activity LED
            pin@p27 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p46 { function = "input";  termination = "no_pulling";    }; // Hotplug
            pin@p47 { function = "input";  termination = "no_pulling";    }; // SD_CARD_DETECT
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <2>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <3>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <27>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <5>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "absent";
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <16>;
            };
            pin_define@LAN_RUN {
               type = "internal";
               number = <6>;
            };
            pin_define@SMPS_SDA {
               type = "absent";
            };
            pin_define@SMPS_SCL {
               type = "absent";
            };
            pin_define@ETH_CLK {
               type = "absent";
            };
            pin_define@USB_LIMIT_1A2 {
               type = "absent";
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "internal";
               number = <40>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <45>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <1>;
            };
            pin_define@SD_CARD_DETECT {
               type = "internal";
               number = <47>;
            };
            pin_define@ID_SDA {
               type = "absent";
            };
            pin_define@ID_SCL {
               type = "absent";
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <2>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <3>;
            };
         }; // pin_defines
      }; // pins_rev1

      pins_rev2 {
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p0  { function = "i2c0";   termination = "pull_up"; }; // I2C 0 SDA
            pin@p1  { function = "i2c0";   termination = "pull_up"; }; // I2C 0 SCL
            pin@p5  { function = "output"; termination = "pull_down"; }; // CAM_LED
            pin@p6  { function = "output"; termination = "pull_down"; }; // LAN NRESET
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p16 { function = "output"; termination = "pull_up"; polarity = "active_low"; }; // activity LED
            pin@p21 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p46 { function = "input";  termination = "no_pulling";    }; // Hotplug
            pin@p47 { function = "input";  termination = "no_pulling";    }; // SD_CARD_DETECT
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <21>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <5>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "absent";
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <16>;
            };
            pin_define@LAN_RUN {
               type = "internal";
               number = <6>;
            };
            pin_define@SMPS_SDA {
               type = "absent";
            };
            pin_define@SMPS_SCL {
               type = "absent";
            };
            pin_define@ETH_CLK {
               type = "absent";
            };
            pin_define@USB_LIMIT_1A2 {
               type = "absent";
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "internal";
               number = <40>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <45>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <3>;
            };
            pin_define@SD_CARD_DETECT {
               type = "internal";
               number = <47>;
            };
            pin_define@ID_SDA {
               type = "absent";
            };
            pin_define@ID_SCL {
               type = "absent";
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <1>;
            };
         }; // pin_defines
      }; // pins

      pins_bplus1 { // Pi 1 Model B+ rev 1.1
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
            pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
            pin@p31 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Power low
            pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED
            pin@p35 { function = "output"; termination = "pull_down"; }; // LAN_RUN
            pin@p38 { function = "output"; termination = "no_pulling";    }; // USB current limit (0=600mA, 1=1200mA)
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p41 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p46 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
            pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <29>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <41>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <32>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "internal";
               number = <31>;
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <47>;
            };
            pin_define@LAN_RUN {
               type = "internal";
               number = <35>;
            };
            pin_define@SMPS_SDA {
               type = "absent";
            };
            pin_define@SMPS_SCL {
               type = "absent";
            };
            pin_define@ETH_CLK {
               type = "internal";
               number = <44>;
            };
            pin_define@USB_LIMIT_1A2 {
               type = "absent";
            };
            pin_define@SIO_1V8_SEL {
               type = "internal";
               number = <38>;
            };
            pin_define@PWML {
               type = "internal";
               number = <45>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <3>;
            };
            pin_define@SD_CARD_DETECT {
               type = "absent";
            };
            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines
      }; // pins

      pins_bplus2 { // Pi 1 Model B+ rev 1.2
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p17 { function = "input";  termination = "no_pulling"; }; // Watchdog
            pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
            pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
            pin@p31 { function = "output"; termination = "pull_down"; }; // LAN_RUN
            pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED
            pin@p35 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Power low
            pin@p38 { function = "output"; termination = "no_pulling";    }; // USB current limit (0=600mA, 1=1200mA)
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p41 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p46 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
            pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <29>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <41>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <32>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "internal";
               number = <35>;
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <47>;
            };
            pin_define@LAN_RUN {
               type = "internal";
               number = <31>;
            };
            pin_define@SMPS_SDA {
               type = "absent";
            };
            pin_define@SMPS_SCL {
               type = "absent";
            };
            pin_define@ETH_CLK {
               type = "internal";
               number = <44>;
            };
            pin_define@USB_LIMIT_1A2 {
               type = "internal";
               number = <38>;
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "internal";
               number = <45>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <3>;
            };
            pin_define@SD_CARD_DETECT {
               type = "absent";
            };
            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines
      }; // pins

      pins_aplus {
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
            pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
            pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED
            pin@p35 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Power low
            pin@p38 { function = "output"; termination = "no_pulling";    }; // USB current limit (0=600mA, 1=1200mA)
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p41 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p46 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
            pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <29>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <41>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <32>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "internal";
               number = <35>;
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <47>;
            };
            pin_define@LAN_RUN {
               type = "absent";
            };
            pin_define@SMPS_SDA {
               type = "absent";
            };
            pin_define@SMPS_SCL {
               type = "absent";
            };
            pin_define@ETH_CLK {
               type = "absent";
            };
            pin_define@USB_LIMIT_1A2 {
               type = "internal";
               number = <38>;
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "internal";
               number = <45>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <3>;
            };
            pin_define@SD_CARD_DETECT {
               type = "absent";
            };
            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines
      }; // pins

      pins_2b1 { // Pi 2 Model B rev 1.0
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA / SMPS_SDA
            pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL / SMPS_SCL
            pin@p31 { function = "output"; termination = "pull_down"; }; // LAN_RUN
            pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED
            pin@p35 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Power low
            pin@p38 { function = "output"; termination = "no_pulling";    }; // USB current limit (0=600mA, 1=1200mA)
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p41 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p46 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
            pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <29>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <41>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <32>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "internal";
               number = <35>;
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <47>;
            };
            pin_define@LAN_RUN {
               type = "internal";
               number = <31>;
            };
            pin_define@SMPS_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@SMPS_SCL {
               type = "internal";
               number = <29>;
            };
            pin_define@ETH_CLK {
               type = "internal";
               number = <44>;
            };
            pin_define@USB_LIMIT_1A2 {
               type = "internal";
               number = <38>;
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "internal";
               number = <45>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <3>;
            };
            pin_define@SD_CARD_DETECT {
               type = "absent";
            };
            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines
      }; // pins

      pins_2b2 { // Pi 2 Model B rev 1.1
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            // The firmware changes I2C pin functions on the fly, returning them to inputs when done. But pins 28&29 are
            // not used on a 1.1 Pi2, so the I2C0 function ends up multiply mapped (bad). therefore don't statically map.
            // pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
            // pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
            pin@p31 { function = "output"; termination = "pull_down"; }; // LAN_RUN
            pin@p32 { function = "output"; termination = "pull_down"; }; // Camera LED
            pin@p35 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Power low
            pin@p38 { function = "output"; termination = "no_pulling";    }; // USB current limit (0=600mA, 1=1200mA)
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p41 { function = "output"; termination = "no_pulling";    }; // Camera shutdown
            // Communicate with the SMPS by "bit-bashing" the I2C protocol on GPIOs 42 and 43
            pin@p42 { function = "output"; termination = "pull_up";    }; // SMPS_SCL
            pin@p43 { function = "input";  termination = "no_pulling";    }; // SMPS_SDA
            pin@p44 { function = "gp_clk"; termination = "pull_down"; }; // ETH_CLK - Ethernet 25MHz output
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
            pin@p46 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
            pin@p47 { function = "output"; termination = "pull_down"; }; // activity LED
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "internal";
               number = <46>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
               type = "internal";
               number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN {
               type = "internal";
               number = <29>;
            };
            pin_define@CAMERA_0_SHUTDOWN {
               type = "internal";
               number = <41>;
            };
            pin_define@CAMERA_0_UNICAM_PORT {
               type = "internal";
               number = <1>;
            };
            pin_define@CAMERA_0_LED {
               type = "internal";
               number = <32>;
            };
            pin_define@FLASH_0_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_0_INDICATOR {
               type = "absent";
            };
            pin_define@FLASH_1_ENABLE {
               type = "absent";
            };
            pin_define@FLASH_1_INDICATOR {
               type = "absent";
            };
            pin_define@POWER_LOW {
               type = "internal";
               number = <35>;
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "internal";
               number = <47>;
            };
            pin_define@LAN_RUN {
               type = "internal";
               number = <31>;
            };
            pin_define@SMPS_SDA {
               type = "internal";
               number = <43>;
            };
            pin_define@SMPS_SCL {
               type = "internal";
               number = <42>;
            };
            pin_define@ETH_CLK {
               type = "internal";
               number = <44>;
            };
            pin_define@USB_LIMIT_1A2 {
               type = "internal";
               number = <38>;
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "internal";
               number = <45>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            pin_define@SAFE_MODE {
               type = "internal";
               number = <3>;
            };
            pin_define@SD_CARD_DETECT {
               type = "absent";
            };
            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines
      }; // pins

      pins_cm {
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling";    }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; }; // RX uart0
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
         }; // pin_config

         pin_defines {
         }; // pin_defines
      }; // pins_cm
   };
};
pelwell commented 9 years ago

Compiling your dt-blob.dts to dt-blob.bin and loading it onto my Rev 1.2 B+ gives the expected behaviour - the pull (down) is removed shortly after power is applied. If I hide the dt-blob.bin and warm reboot (i.e. sudo shutdown -r now) then that lack of a pull persists (this behaviour changed in July - prior to that all pulls were initialised to their defaults, but now only those pins mentioned in the dt-blob are changed). A full power-cycle restores the pull to the usual pull-down.

If you have external hardware connected to the GPIO pins then please remove it and repeat your testing as I suspect the pull-up is external to your Pi. If not, then it sounds like your Pi may have a fault.

swarren commented 8 years ago

I believe the default pull state documented in BCM2835-ARM-Peripherals.pdf will always apply at cold boot; it's something that is implemented in hardware or non-modifiable boot ROM. Once the FW gets started, it could reprogram the pull based on DT/..., but this will always need some time, so there will always be a window where the default HW configuration is active. A reboot/reset (a) possibly just resets the CPUs and not all HW modules and (b) is a reset not a cold boot anyway. Either would explain why the HW defaults don't get re-applied temporarily during a reboot.

Perhaps you can choose a different pin for this purpose; some pins have a default pull-up and some a default pull-down according to that PDF, but I don't recall any that start out floating. Alternatively, you could insert a tri-state driver chip between GPIO17 and your application, although you'd need to use some other GPIO (or perhaps I2C/SPI) to control that driver's tristate.

JamesH65 commented 6 years ago

Closing due to lack of activity. Please request to be reopened if you feel this issue is still relevant.