Re: [PATCH] gpio-sch: set output level after configuration of direction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 26 March 2014 20:05:43, Gerhard Sittig wrote:
> On Tue, 2014-03-25 at 10:33 +0100, Alexander Stein wrote:
> > 
> > According to the datasheet, writing to the level register has no effect
> > when GPIO is programmed as input. Hence we set the level after configuring
> > the GPIO as output. But we cannot prevent a short low pulse if direction is
> > set to high and an external pull-up is connected.
> 
> Does "will have no effect" actually translate into "should not be
> done" or even "must not be done"?  Doesn't sound like it.

I would translate that into 'won't do anything', it's read-only, thus the written value is lost. It just reflects the current signal when configured as input.

> I understood that setting the data register for input pins does
> nothing in that very moment, yet when switching to output the
> value immediately gets used.  So this is the most appropriate
> thing to do.

That would be the correct way, if hardware can be programmed that way. But if the data register is set when GPIO is confgured as input the data is lost. So when switching to output it does _NOT_ have the previously set value.
That's why the direction is set first and data afterwards. Awkward, but yet the only way to set an "initial" output value

Regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: alexander.stein@xxxxxxxxxxxxxxxxxxxxx
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux