Problem with the drivers in the SDcard A13-olinuxino-SD

Started by Thomas, November 08, 2012, 04:24:57 PM

Previous topic - Next topic

Thomas

Hi.
I'm using A13-Olinuxino-WiFi with your Debian image in A13-olinuxino-SD.

When I'm typing as root "lsmod", I do not see sun4i_gpio (=gpio driver).
In addition, the directory /sys/devices/virtual/misc/sun4i_gpio does not exist.

As it is said in the Olimex wordpress, these drivers are supposed to be in this SDcard. (http://olimex.wordpress.com/2012/10/23/a13-olinuxino-playing-with-gpios)

Any suggestion ?
Thank you.

Here is my lsmod output :

root@debian:~# lsmod
Module Size Used by
bfcon 35991 70
bitblit 4187 1 fbcon
softcursor 1123 1 bitblit
font 7767 1 fbcon
8192cu 511517 0

vinifr

#1
Fisrt, you need compile it. Preferably as a module. In source code directory type:
# make ARCH=arm menuconfig
Choice: Device Drivers -> (*)Misc Devices -> <M> An ugly sun4i gpio driver
So, Exit, Exit, Exit, yes to save.

After, anywhere type:
# modprobe sun4i-gpio
Thereafter, the file device will be created. But your script.bin need to be configured to work.
My script.bin/script.fex: http://dl.dropbox.com/u/22273442/script.fex

David Goadby

I too am using A13-Olinuxino-WiFi with the Debian SD purchased from Olimex. If I type lsmod then I do have sun4i_gpio. In fact my lsmod output has a lot more entries than yours including usbnet and asix (for Ethernet). 

I also checked the folder /sys/devices/virtual/misc/sun4i_gpio and that exists too.

As you might expect the GPIO commands work as per the recent blog entry too.

Since I have the latest SD card from Olimex (arrived here on October 25th) then I have to assume that your SD card is either corrupt or not the correct one for the A13.



Thomas

Hi,
@viniciusfre Thank you, I'm going to try it now.
@David Goadby I purchased mine on october 17th... I must be unlucky. Could you write your full lsmod output please ? Thanks.
@Olimex moderator, can you tell me more about those missing drivers on your SD card ? Thank you.

Thomas.

Thomas

Allright,
I'm able to launch sun4i_gpio now, it appears in lsmod.
Vinciusfre (or anyone), could you tell me where I must put the script.fex file and how to use it ?

Thanks !
Thomas.

Thomas

Now I can see the files (modprobe sun4i-gpio worked) in /sys/devices/virtual/misc/sun4i_gpio

This shell command to light up the green LED works well :
echo 1 > /sys/devices/virtual/misc/sun4i-gpio/pin/pg9

However, as I expected, I miss the mapping in the script.fex file, that's why nothing happens in running the following C code :

    #include "gpio-mmap.h"

    int main() {
    gpio_map();
    gpio_output(2,1); //bank 2 bit 1 = GPIO65 the LED on board
    while (1) {
    GPIO_WRITE_PIN(65,1);
    GPIO_WRITE_PIN(65,0);
    }
    }


Please help me I need this script.fex mapping :(

PS : The command and the C code were found here : http://olimex.wordpress.com/2012/10/23/a13-olinuxino-playing-with-gpios/

vinifr

If there is pg9 into .../sun4i-gpio/ then your script.bin/script.fex is ok.

I guess the problem lies in the functions you are using. Try this: https://github.com/hno/Allwinner-Info/blob/master/A13/test1/gpio.c

Thomas

Hi vinciusfre,
Thank you for your help.
Any of your functions result in "segmentation fault".
I tried :

gpio_get_value(number);

with number from 1 to 100, but "segmentation fault" occurs all the time.
Is it the right usage ?

Thanks.
Thomas.

vinifr

#8
Well, I have not yet tested.  ;D

Try this:
#include "gpio.h"

int main()
{
   gpio_set_value(SUNXI_GPG(9), 1); // set pg9

   return 0;
}


Do not forget to include into gpio.h:
int gpio_get_value(unsigned gpio);
int gpio_set_value(unsigned gpio, int value);


Thomas

segmentation fault.

:(

Thank you anyway for persevering. Because other people apparently do not have this problem, maybe the easier solution is just to buy another SD card ?

Anyway, your code works for your A13 ?

Thomas.

vinifr

#10
Sorry for the delay. Here is the answer:

<vinifm> hno: first i load sun4i-gpio...
<vinifm> complete code: http://dl.dropbox.com/u/22273442/gpio.tar.gz
<hno> That code is for running bare-bone within u-boot. You need some small changes to use it in linux.
<hno> gpio driver is not needed. But you need to mmap the PIO registers and bang on them..

Thomas

Thank you, anyway...


ERROR (404)
We can't find the page you're looking for. Check out our Help Center and forums for help, or head back to home.

Please could you upload it again ? :)

vinifr

#12
Here: http://dl.dropbox.com/u/22273442/A13/gpio.tar.gz, but the result is the same:
Segment Fault

As hno said, we must adapt to linux.  ;D

There a driver newer: http://dl.dropbox.com/u/22273442/A13/sun4i-gpio.patch

But, I still have not tested.