Prevent pin from being pulled low at boot

EvanEvan New Member Posts: 4
In Ubuntu 16.04, how can I make sure a pin is held high throughout the boot process? I have tried setting pin levels on boot in an init script (on ubuntu, run level 0), while this works there is a 5-10 second delay during boot during which the pin I need to keep high (and which is already held high with a pull-up resistor) is pulled low. I either need the UpBoard to leave the pin floating during boot so it's pulled high by the pullup resister, or pull it high, anything but pulling it actively low. How can I accomplish this?


  • Dan O'DonovanDan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    Hi anon124

    Can you tell me which pin you are attempting to keep high? Also, can you tell me which kernel version you're using ('uname -r' will give you that information).

  • EvanEvan New Member Posts: 4
    The PWM pins (I think 32 and 33 by Upboard numbering).

    Kernel 4.4.0-2-upboard
  • Dan O'DonovanDan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    One thing to try would be to disable the PWM controllers in the BIOS. There's an option buried in the BIOS menus for this. I don't have an UP board close to hand at the moment, to remind me how to navigate to those options, but I'll check when I get a chance (if you don't find it before me ;-) ).

    At the moment, our UP platform driver is using the presence of the PWM controller as an indication to set up these pins for PWM output by default at boot time. That's probably the main factor in the behaviour that you're seeing, but there might be other things at play there as well. Lets go step by step and see if we can resolve it.
  • EvanEvan New Member Posts: 4
    Sorry if I wasn't clear, I want to use the pin as PWM so I don't want to disable that. After boot I am able to set the pin at 100% duty cycle and all is fine. However, during boot before my init script runs the pin is pulled low (to 0% duty cycle). Is there any way to configure this so that it starts at 100% instead of 0%?
  • Dan O'DonovanDan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    Ah, I see. I had assumed that you were using them as GPIOs.

    Unfortunately, with the way the drivers are set up right now, I can't think of an easy way to do this. The PWM driver won't get probed, as far as I remember, until the UP platform driver is loaded. That means that you can't easily configure the PWM duty cycle before enabling the pins as outputs (which is done automatically by the UP platform driver when it loads and sees the PWM device). There may be some hacks that could be done within the UP platform driver to break that dependency and yet still have those pins configured as output by default. And then it would also be necessary to avoid loading the UP platform driver until you've had a chance to configure the PWM duty cycle as you want it. Doable, but not trivial :-(
  • EvanEvan New Member Posts: 4
    ok I see. Based on the timing of when the pins were pulled actively low (i.e. not when power up started, but later on, just a few secs before init scripts run), it seemed like the UP drivers were setting PWM to 0 / pulling the pin actively low, but you're saying this is performed before the UP drivers load? By the linux kernel? Or by the firmware on the Altera? Thanks for the advice - this will help us to track down a fix
Sign In or Register to comment.