Accessing GPIO outside of Ubilinux

wayneMT
wayneMT New Member Posts: 2

Afternoon all,

I have been using UP Boards for many months now and this particular one is 4th (not because they break, because I keep getting new ideas!) and I've bought a UPS Hat for it from the up-shop. I'm having trouble getting the SUSV daemon service running as it's throwing an error when I try to start it. Now, I'm sure this would have a different outcome on Ubilinux but for this particular project I'm using Kali Linux which for several reasons needs it's own kernel to remain installed.

I've checked dmesg after trying to start the daemon and it throws the error "export_store: invalid GPIO 27". Sure enough if i try to export that pin manually using "echo 27 > /sys/class/gpio/export" it also fails. This makes complete sense because those pins are mapped as a base offset from one of the 4 "/sys/class/gpio/gpiochip" instances. So if it was possible to change which pins the daemon needs to export in order to communicate with the UPS Hat all would be well, but as that's not currently possible is there a way to link or re-map the GPIO assignments in /sys/class/gpio? or perhaps a kernel patch?

I'm completely open to suggestions here so any help is greatly appreciated.

Comments

  • wayneMT
    wayneMT New Member Posts: 2

    Managed to figure it out for anyone that has a similar requirement:

    • Grab the commit from this post http://forum.up-community.org/discussion/2447/i2c-interface-needs-a-long-time-to-initialize (append .patch to the URL to download as a patch file if needed)
    • Install and unpack the kernel source for your target OS and integrate the commit. For me the actual driver code applied when the patch was run without issue as they are new files, but the supporting files needed to be modified manually (Kconfig, Makefile, etc).
    • Build and install the new kernel, reboot.

    For me this just worked and immediately after the reboot I was able to see 'gpiochip0' appear in /sys/class/gpio which allowed me to export the required values as per my previous post. The time it takes to initialize i2c has also been dramatically reduced.

    Hope this helps.

  • asilva
    asilva New Member Posts: 13

    Hi,
    with firmware version on the hat you use?

    I recently update to 2.40 but now every time i unplug the energy the board reboots.. it happens to you to?

    I'm also facing that after the reboot the susv client can't find nay device..

    Thanks for the help.

    Regards,
    António

Privacy Policy