[U-Boot] Sunxi (Allwinner A20) GPIO problems on u-boot 2016.1 and 2016.3-rc3 but not on 2015.10

I am trying to get an Olimex A20-SOM running but I am experiencing strange problems on some of the GPIO pins on the device.
We are using (amongst others) pin PE6 as GPIO output but somehow there seems to be a change between U-Boot 2015.10 and 2016.01 in the default behaviour of these particular pins.
When generating a default config in 2016.01 (for example using 'A20-OLinuXino-Lime_defconfig' or 'A20-Olimex-SOM-EVB_defconfig') and then booting the device with this config I can observe the following:
'gpio status -a PE6' tells me that the pin is INPUT and the value is sometimes 0 and sometimes 1. When I measure the pin that is connected to 3V3 using a 10K pull up on my board, I measure 0.83V. That is strange because it should be 3.3V (as it is said to be an input).
'gpio set PE6' tells me that the pin is now OUTPUT and set to 1, so I should measure 3V3 on the pin but the pin Voltage is actually around 0.71V. Switching the pin low with 'gpio clear PE6' gives back a voltage of 0.83V. It seems that internally there is a pull down active or something although I cannot find this specifically set in the .config configuration file.
When using U-Boot 2015.10 the problem disappears completely (still using the defconfig). Although I'm fine with using U-Boot 2015.10, I think it is weird that the GPIO pin does not follow any of my instructions and seems to live its own life in 2016.01 and 2016.03-rc3.
So summarized, pin PE6 in U-Boot 2015.10 is OK:
PE6 Set to input (default at startup) = 3V3 measured PE6 Set to output, high = 3V3 measured PE6 Set to output, low = 0V measured
In U-Boot 2016.01 and 2016.03-rc3 it's not OK
PE6 Set to input (default at startup) = 0.83V measured PE6 Set to output, high = 0.83V measured PE6 Set to output, low = 0.71V measured
In addition to this; I'm booting a mainline kernel (not the special sunxi kernel). I can manage the GPIO pins there as well but the behaviour is the same (the same voltages measured). The kernel does not seem to have any specific runtime option for enabling or disabling pull ups or downs, but I didn't really look into this as u-boot already misbehaves and some of our peripherals won't start on boot because of this.
I hope anyone can help me out.
Regards, Hendrik

Hi,
On 02-03-16 17:54, Hendrik wrote:
I am trying to get an Olimex A20-SOM running but I am experiencing strange problems on some of the GPIO pins on the device.
We are using (amongst others) pin PE6 as GPIO output but somehow there seems to be a change between U-Boot 2015.10 and 2016.01 in the default behaviour of these particular pins.
When generating a default config in 2016.01 (for example using 'A20-OLinuXino-Lime_defconfig' or 'A20-Olimex-SOM-EVB_defconfig') and then booting the device with this config I can observe the following:
'gpio status -a PE6' tells me that the pin is INPUT and the value is sometimes 0 and sometimes 1. When I measure the pin that is connected to 3V3 using a 10K pull up on my board, I measure 0.83V. That is strange because it should be 3.3V (as it is said to be an input).
'gpio set PE6' tells me that the pin is now OUTPUT and set to 1, so I should measure 3V3 on the pin but the pin Voltage is actually around 0.71V. Switching the pin low with 'gpio clear PE6' gives back a voltage of 0.83V. It seems that internally there is a pull down active or something although I cannot find this specifically set in the .config configuration file.
When using U-Boot 2015.10 the problem disappears completely (still using the defconfig). Although I'm fine with using U-Boot 2015.10, I think it is weird that the GPIO pin does not follow any of my instructions and seems to live its own life in 2016.01 and 2016.03-rc3.
So summarized, pin PE6 in U-Boot 2015.10 is OK:
PE6 Set to input (default at startup) = 3V3 measured PE6 Set to output, high = 3V3 measured PE6 Set to output, low = 0V measured
In U-Boot 2016.01 and 2016.03-rc3 it's not OK
PE6 Set to input (default at startup) = 0.83V measured PE6 Set to output, high = 0.83V measured PE6 Set to output, low = 0.71V measured
In addition to this; I'm booting a mainline kernel (not the special sunxi kernel). I can manage the GPIO pins there as well but the behaviour is the same (the same voltages measured). The kernel does not seem to have any specific runtime option for enabling or disabling pull ups or downs, but I didn't really look into this as u-boot already misbehaves and some of our peripherals won't start on boot because of this.
You can compare the drive-strength and internal pull-up/down settings between versions by booting into Linux and then doing:
sudo ./pio -m PE6
This will show 4 numbers first number is the pinmux, second the pull-up/down setting, third the drive strength and last the value (read / driven out).
You can find the pio tool here:
https://github.com/linux-sunxi/sunxi-tools/blob/master/pio.c
I expect you to find that the values have not changed between u-boot versions, more likely the board is using some ldo or some such to provide PORTE with power, and this commit is the culprit:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=02cc27c74f9b884b538bcd1b9334...
You could try reverting that, or simply adding:
CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800
to the defconfig for your board
Regards,
Hans

Hello Hans,
Thank you very much for your message. The PIO program reported 'PE6<0><0><1><1>' for both U-Boots but changing the configuration's CONFIG_AXP_ALDO3_VOLT and CONFIG_AXP_ALDO4_VOLT back to 2800 did indeed solve the problem. I can run U-Boot 2016.01 now and control PE6 properly.
LDO3 is connected to pin F19 in the Olimex schematics (VCC_CSI0, in the A20 datasheet mentioned as Port E Power Supply) and LDO4 is connected to pin E18 (VCC_CSI1 mentioned as Port G Power Supply).
So would the change in u-boot make sense by setting the default to 0 now? I'm not sure if the git remark 'LDO3 and LDO4 are normally either unused, or used to power csi attached camera sensors' is correct as it seems (also?) to be the source or reference for the A20 chip pins itself..? At least this is the case for multiple (all?) Olimex A10/A20 boards (I checked A20-SOM, A20-LIME2, A20-Lime and A10-Lime).
Regards, Hendrik

Hi,
On 03-03-16 17:54, Hendrik wrote:
Hello Hans,
Thank you very much for your message. The PIO program reported 'PE6<0><0><1><1>' for both U-Boots but changing the configuration's CONFIG_AXP_ALDO3_VOLT and CONFIG_AXP_ALDO4_VOLT back to 2800 did indeed solve the problem. I can run U-Boot 2016.01 now and control PE6 properly.
LDO3 is connected to pin F19 in the Olimex schematics (VCC_CSI0, in the A20 datasheet mentioned as Port E Power Supply) and LDO4 is connected to pin E18 (VCC_CSI1 mentioned as Port G Power Supply).
So would the change in u-boot make sense by setting the default to 0 now? I'm not sure if the git remark 'LDO3 and LDO4 are normally either unused, or used to power csi attached camera sensors' is correct as it seems (also?) to be the source or reference for the A20 chip pins itself..? At least this is the case for multiple (all?) Olimex A10/A20 boards (I checked A20-SOM, A20-LIME2, A20-Lime and A10-Lime).
The using of ldo3/4 for pins which are on a general header seems to be an olimex board thing, I've checked a few non olimex schematics:
-cubieboard: has E18 / E19 connected to VCC-3V3 -cubietruck: has E18 / E19 connected to VCC-3V3 -bananapi: has E18 connected to VCC-3V3, E19 to VCC-CSI which seems to come from the camera connector -orangepi: has E18 / VCC-PE connected to VCC-3V3, E19 to VCC-CSI0 which comes from a dedicated LDO, not one the axp ldo-s -orangepi-mini: has E18 / VCC-PE connected to VCC-3V3, E19 to VCC-CSI0 which comes from a dedicated LDO, not one the axp ldo-s
Also note that even if you enable LDO3 and LDO4 in the boot-loader, the kernel will go and turn them off as soon as it is done booting, the fact that it doesn't for you means that you probably do not have the dts bits for the kernel to properly control the axp209 regulators yet, as soon as you add this ldo3 and ldo4 will get turned off after kernel boot, unless you spcecificaly declare them as always-on in the dts.
With that said, I will happily accept u-boot patches to enable LDO3 / LDO4 for Olimex boards where the PE / PF pins are connected to a general purpose header.
Regards,
Hans
participants (2)
-
Hans de Goede
-
Hendrik