SPI&GPIO

You have a problem with your Wandboard and want to ask the community for help.

Re: SPI&GPIO

Postby Tapani » Fri Oct 11, 2013 3:16 am

x0rad wrote:I was also interested in some questions.
1. For example, if I disable a i2c, is it possible to reassign the it pin as eGPIO?


Yes. For instance, the SPI pins are unused by the Wandboard and routed out to JP-4 (together with the other external GPIOs).
Maybe start with setting those in GPIO mode (in boardfile ) and disabling the SPI setup?

x0rad wrote:2. This question is more to Linux. Is it possible to configure the external interrupt on GPIO?


Yes: http://bec-systems.com/site/281/how-to- ... t-in-linux
Tapani
Site Admin
 
Posts: 712
Joined: Tue Aug 27, 2013 8:32 am

Re: SPI&GPIO

Postby x0rad » Mon Oct 14, 2013 1:25 pm

Hello!
Thanks for the answers! I have a question again:)

I am trying to set the interrupt as in http://bec-systems.com/site/281/how-to- ... t-in-linux

In board_wand:
1. turned off one of the external GPIO, to use it with GPIO_KEYS
Code: Select all
gpio_export(IMX_GPIO_NR(3, 27), true);
   //gpio_request(IMX_GPIO_NR(6, 31), "external_gpio_2");
   //gpio_export(IMX_GPIO_NR(6, 31), true);
   gpio_request(IMX_GPIO_NR(1, 24), "external_gpio_3");

2. setting GPIO_KEYS
Code: Select all
#define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake)    \
{                                                               \
        .gpio           = gpio_num,                             \
        .type           = EV_KEY,                               \
        .code           = ev_code,                              \
        .active_low     = act_low,                              \
        .desc           = "btn " descr,                         \
        .wakeup         = wake,                                 \
}

static struct gpio_keys_button button_table[] = {
        GPIO_BUTTON(IMX_GPIO_NR(6, 31), KEY_RECORD, 1, "back",  0) 
};

static struct gpio_keys_platform_data button_data = {
        .buttons        = button_table,
        .nbuttons       = ARRAY_SIZE(button_table),
};

static struct platform_device button_device = {
        .name           = "gpio-keys",
        .id             = -1,
        .num_resources  = 0,
        .dev            = {
                .platform_data = &button_data,
        }   
};

static void __init wand_init_device_buttons(void)
{
        platform_device_register(&button_device);
}


3. Added this init-function on __init wand_board_init():
Code: Select all
static void __init wand_board_init(void) {
...
wand_init_device_buttons();
...
}



After building the kernel, I have not received the new /dev/input/eventX
Also, I tried to compile a kernel with options:
Code: Select all
CONFIG_INPUT_GPIO=y
CONFIG_INPUT_KEYBOARD=y


What am I doing wrong?
How to turn gpio_keys?
Maybe I used the wrong initialization function?
(Maybe I should use gpio_keys_setup_key() or something else??)
If someone has already repeated this with Wandboard, can look at the settings?

Thanks!
x0rad
 
Posts: 14
Joined: Thu Sep 19, 2013 7:44 am

Re: SPI&GPIO

Postby x0rad » Wed Oct 16, 2013 9:06 am

Hey.
Hi.
I built the kernel, and get new /dev/input/eventX.

At first, I was trying to do so:
Code: Select all
...
static struct platform_device button_device = {
        .name           = "gpio-keys",
        .id             = -1,
        .num_resources  = 0,
        .dev            = {
                .platform_data = &button_data,
        }   
};

static struct __initdata platform_device *tablet_devices[] = {
        &button_device,
};

static void __init wand_init_device_buttons(void)
{
platform_add_devices(tablet_devices, ARRAY_SIZE(tablet_devices));
}

But did not work out...

Troubles was in a configuration of a kernel.
I added:
Code: Select all
CONFIG_KEYBOARD_GPIO=y # ??
CONFIG_KEYBOARD_ATKBD=y # ??
CONFIG_INPUT_KEYBOARD=y

CONFIG_INPUT_MISC=y
CONFIG_INPUT_GPIO=y

CONFIG_SERIO=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_LIBPS2=y

CONFIG_INPUT_EVDEV=y #Default =y !


Then I got it.

And yet, I doing it right?
Now, I will try make demo-hendler for input/event...
//------------------------------------------------
I have checked up ' evtest ' and have made the program. It work.
Note:evtest processes all in a cycle :cry:
Probably it someone is useful: http://www.linuxjournal.com/node/8545/print
x0rad
 
Posts: 14
Joined: Thu Sep 19, 2013 7:44 am

Re: SPI&GPIO

Postby Hardy » Mon Dec 02, 2013 8:30 pm

Hi,

I have a Dual Wandboard and tried to get SPI running ...

I have set CONFIG_SPI_SPIDEV=y with 'make config' and put the posted code to board-wand.c
Then I continued with 'make wandboard_defconfig' and 'make -j4 uImage modules'.

I will get some errors .... I tried to do these steps with the wandboard-sdk-20130614.

Can you explain a little more detailed which steps needs to be done.
Hardy
 
Posts: 4
Joined: Mon Dec 02, 2013 8:18 pm

Re: SPI&GPIO

Postby x0rad » Thu Dec 12, 2013 8:33 am

Hi, Hardy.
Could you tell us more about the configuration and build the kernel?
If build errors - show output gcc.

What changes have you made in the file board_wand.c?
Reread the thread(CONFIG_SPI;CONFIG_SPI_SPIDEV; etc?). Perhaps the problem is that you did change in "wandboard_ubuntu_defconfig" and in make use "wandboard_defconfig"?
Do you get errors at compile time or a problem in non-appearance(??fucking english) /dev/spidevX?

Sure, I can give you "defconfig" and board_wand.c. But it's boring, right? :P
x0rad
 
Posts: 14
Joined: Thu Sep 19, 2013 7:44 am

Re: SPI&GPIO

Postby Hardy » Thu Dec 26, 2013 12:48 pm

Hi x0rad,

thank you for the reply - in between I have SPI running - even on Python it is running. :)

I forgot to #include <linux/spi/spi.h>

and had mistake in

static void __init wand_init_spi(void) {
IMX6_SETUP_PAD( EIM_D16__ECSPI1_SCLK );
IMX6_SETUP_PAD( EIM_D17__ECSPI1_MISO );
IMX6_SETUP_PAD( EIM_D18__ECSPI1_MOSI );
IMX6_SETUP_PAD( EIM_EB2__GPIO_2_30 );

IMX6_SETUP_PAD( EIM_CS0__ECSPI2_SCLK );
IMX6_SETUP_PAD( EIM_CS1__ECSPI2_MOSI );
IMX6_SETUP_PAD( EIM_OE__ECSPI2_MISO );
/* The choice of using gpios for chipselect is deliberate,
there can be issues using the dedicated mux modes for cs. */
IMX6_SETUP_PAD( EIM_RW__GPIO_2_26 );
IMX6_SETUP_PAD( EIM_LBA__GPIO_2_27 );

imx6q_add_ecspi(0, &wand_spi1_data);
imx6q_add_ecspi(1, &wand_spi2_data);
spi_register_board_info(wbquad_spi_devices, ARRAY_SIZE(wbquad_spi_devices));
}

Test with spidev_test.c

so with all the other informations it was possible to get SPI running.

Now I'm working on getting a LCD Display running - g121sn01v4 from AUO -
in general it works with the SEIKO-WVGA settings but need to change settings
to 800x600 - after changing the driver files (just resolution values) 'make' shows some errors -
is there a special make command for driver files?

Best regards,
Hardy
Hardy
 
Posts: 4
Joined: Mon Dec 02, 2013 8:18 pm

Re: SPI&GPIO

Postby Siblens275 » Wed Jan 17, 2018 10:56 am

The system could call individuals at once for different tasks, hartjes claimed. AesopOnline Login Guide for Frontline Education | www.aesoponline.com or the Griffin-Spalding County School System in Griffin.
Siblens275
 
Posts: 1
Joined: Wed Jan 17, 2018 10:56 am

Re: SPI&GPIO

Postby jamesjohn70 » Fri Mar 09, 2018 12:18 pm

Hi.
Tell me, what changes should I make to board_wand.c to gain access to /dev/spi from user space?
And I not understand how Linux assigns numbers to /sys/class/gpioN ?
Thanks!

----------------------
Now Cric booth Just Starting PSL Live Streaming free and Update about All Matches
jamesjohn70
 
Posts: 1
Joined: Fri Mar 09, 2018 12:15 pm

Previous

Return to Getting started

Who is online

Users browsing this forum: No registered users and 3 guests