Hi, Micro2440 sets some GPIO pins with 3v3 during the kernel boot. When linux starts, my application set those pins to 0. Now, I need to change one of these pins to 0v during kernel boot, before the system start up. I already knows how to control GPIO pin, but I don't which file is responsible for the sequence of commands executed during the boot. Anyone knows where could I find some useful information? Thanks in advance
Change gpio pin value during kernel boot
I change my GPIO pins in /etc/profile.environment. However, I am using the Pengutronix BSP. From memory, for the FriendlyArm distros try /etc/rcS or somewhere in /etc/init.d
Hi Dave, Thanks for your fast reply :D When rcS starts it's too late. I need to set those pins even before that. I think I'll need to change some source file from kernel (and compile it again)...
Hi Eduardo, I have the same problem with Microcontrollers, I think is a hardware problem rather than a software, everytime I start a pic or atmel even if I set the pins low they go high,
eduardo, Sorry, didn't see words "before the system starts". As a hardware work-around, maybe try inverting that output with an external transistor and then invert the logic for that GPIO. However, there might be a short period where that pin would be incorrect, ie between kernel initialisation and when you could change it in /etc/rcS. Good luck! Dave
Hi Andre, This is normal for microcontrollers like the PIC and Atmel. The ports are usually set to input with a weak pullup. If you need it low on power up and before your application has started, you can fit a pull down resistor on the IO Pin. Some microcontrollers will be LOW state. Consulting the datasheet will let you know. I have had to do this with the Mini6410 for the power supply to stay on. I am working on this pin powering down the device under software control. It's default state is LOW and an input and I need it HIGH so I installed a pullup. Dave...
eduardo, you can change the GPIO settings in the u-boot bootloader or in the Linux kernel in the platform file (arch/arm/mach-s3c2440/mach-mini2440.c).
Hi, Thanks for all responses. I don't want to change hardware stuff... I'll try to find a software solution. Yesterday I changed the file "linux-2.6.32.2/arch/arm/mach-s3c2440/mach-mini2440.c", and I saw that I can control those pins. With a multimeter I saw the pin with 3v3 when I turn on the board, half second later, the pin was down to 0v (that was my modification), and half second later it become 3v3 again. I'll try to find which code was responsible for turn the pin 3v3 again after my modification... xD I'll try it for today. If all go wrong, I'll follow the hardware suggestion. ;) Thanks again
Hi Juergen, Thanks for your reply. I saw it just after post my last reply. I changed the mach-mini2440.c file, and it works (pin goes 0v), but there's another function that turn on the pin with 3v3 again (I don't know where, but with a multimeter I can see that it happens). I'll look for the settings on uboot bootloader. :) Thanks for the suggestion.
If there is somebody who change the GPIO state after the platform file has initialized them, you also have no chance with a modified bootloader. I guess the GPIO you are using is used by a different driver for one of the devices in the S3C2440 CPU. You should take a closer look to the source if this GPIO pin is feed into a different driver via the corresponding platform_data structure (for example the SD/MM driver receives GPIO definitions for the "change detect" and "write protect" signals). You should lock your GPIO pin with the gpio_request() function. In this case someone other will be rejected to use the same pin again. The best place to request a GPIO is again the platform file for the Mini2440 (arch/arm/mach-s3c2440/mach-mini2440.c).
Hi Juergen, Thanks for your response. You are fully corret. Searching for uses of the GPIO constant, I found it on the camera driver. I'm not using this driver, so I cut off this driver of my kernel. The "arch/arm/mach-s3c2440/mach-mini2440.c" file was already changed and everything work like excpected. The problem is solved, thanks for all the help.
Hi I am having the similar problem , I am using the Imx53 board. When start only u--boot LED's will be in OFF state(GPIO - Active low).When kernel boots up those LED's will change the state to ON (GPIO - Active high). I am not able to trace who is setting this GPIOS values high in kernel code , if any one faced same issue, please let me know . Thanks, Adavappa
What I need to change on "linux-2.6.32.2/arch/arm/mach-s3c2440/mach-mini2440.c" to active pullup on GPIO?