1

Currently I'm trying to check the booting time of an Tixi board using systemd on a 2.6.39 linux kernel. To do so I created a service file that calls a bash script which sets and uses a gpio. The problem is that my systems is not allowing me to change the value of the gpio. I can sucessfully export it, change its direction, but NOT the value. I have connected an oscilloscope to check if the value had changed in the hardware but not updated in the file as suggested in some forums, but it was the same: the value just doesn't change! I should also point out that the same script is working if I use system V, with exactly the same coonfiguration for the kernel, busybox and filesystem.

It is very ironic because I'm already the root of the systems, nevertheless even changing the permissions of the file, would not allow me to change its value. There is also no feedback from the kernel saying that the operation was not possible, but rather it looks as if it was possible but when I check the value, it was the same as before.

I also tried to run that in the Raspbian with a 3.12 (which I changed to systemd) and it was in fact possible to do it, just in the normal way from userspace.

I would appreciate if you have any idea oh what might be the problem since I already run out of ideas.

Thanks

PS: This is the code that should work on the bash line:

echo 0 > /sys/class/gpio/gpio104/value
more /sys/class/gpio/gpio104/value
// I get 1 not 0 as I requested

Nevertheless the same lines of code in the same board work if I use systemV but not if I use systemd

carocad
  • 455
  • 6
  • 12
  • Diff the driver source and configuration between working and non-working kernels. Or do you mean it worked on different hardware? If so, the kernel probably doesn't know how to manipulate GPIOs on this hardware and you will need to fix it, or you are not commanding the pin you are probing. – Chris Stratton Aug 05 '14 at 13:57
  • Hey Chris. I already tried to see if the kernel is not recognizing the GPIOs. I editted the question so that everyone else is aware of that. As I say there, the script and the gpios work on userspace if I use system V but when I change to systemd with exactly the same configuration, then it doesn't work anymore. – carocad Aug 06 '14 at 09:12
  • Is the only differenve system V vs systemd, or are you booting different installs with different kernel binaries? – Chris Stratton Aug 06 '14 at 11:58
  • For systemd it is necessary to use (e)glibc and also udev. Those are the only three differences between the two systems. Everything else remains the same. – carocad Aug 06 '14 at 12:54
  • If it were me stuck on that problem, I'd modify the kernel gpio driver to printk every time it did sonething. – Chris Stratton Aug 06 '14 at 13:47

2 Answers2

1

Probably cause by the lack of udev in your new setup which change the permission for those gpio in /sys/class. You might want to just put back udev to see if it fixes your problem.

I don't know your image setting, but each gpio pins needs to be exported prior to usage. Are you doing it or it's done automatically? If you have omap mux kernel switch, you do something like :

echo 0x104 > /sys/kernel/debug/omap_mux/cam_d5 (set mode 4 as stipulate in TI Sitara TRM)
echo 104 > /sys/class/gpio/export (export the pin)
echo out > /sys/class/gpio/gpio104/direction (set the pin as output)

Also do a dmesg | grep gpio and see if there's any initializing problem with the gpio mux.

0

Actually I've faced an issue similar to your's , ie was not able to change the value of set of gpio pin manually

Finally the result obtained was even though the name of that pin is gpio it can only be used for input only (DM3730 gpiO_114 and gpio_115).

So please refer to the datasheet and confirm it can be used for I/O operations..

Sorcrer
  • 1,634
  • 1
  • 14
  • 27
  • Hey Sorcrer, I am already sure that the pins can be use for input/output as they work if I use sysV but not if I use systemd. – carocad Aug 06 '14 at 10:05