Firefly Open Source Community

Title: How do I use SPI? [Print This Page]

Author: schkiki    Time: 2/9/2015 12:29
Title: How do I use SPI?

hello

------test source-----------

device="/dev/spi_misc_test";

fd = open(device, O_RDWR);
if (fd < 0)
  pabort("can't open device");

/*
  * spi mode
  */
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
if (ret == -1)
  pabort("can't set spi mode");

-----------------------------------

however  error abort.


How do I use SPI?


Author: lin_jc    Time: 2/12/2015 11:00
Title: Re: How do I use SPI?

hi schkiki

you can find that spi_misc_test don't have an open function in source file kernel/drivers/spi/spi-rockchip-test.c

static const struct file_operations spi_test_fops = {

.write = spi_test_write,
};
so, it will be an error abort when you open the spi_misc_test.

before you want to open it or read it, you should write an open function, read function by yourself.

by the way, the SPI in firefly-rk3288 using the linux common interface, you can get more samples by google.


Author: LNX_HOBBY    Time: 2/14/2015 06:10
Title: Re: How do I use SPI?

Hello,

I have firefly rk 3288 board.

As I found on the tutorial on the website [wiki gpio ] I tried to use SPI /GPIO but could not found dts file or even kernel/drivers or kernel/.../boot/dts/..etc

I also tried with find and locate command. it does not return any file with *.dts

Are these all about kernel compilation from source ? what are the actual steps I need to perform and what are those ?

Could you please write some more details  about how use GPIO/SPI ..

thanks


Author: naobsd    Time: 2/14/2015 07:57
Title: Re: How do I use SPI?

As I found on the tutorial on the website [wiki gpio ] I tried to use SPI /GPIO but could not found dts file or even kernel/drivers or kernel/.../boot/dts/.. etc

I also tried with find and locate command. it does not return any file with *.dts

dts is in kernel source tree.


Author: LNX_HOBBY    Time: 2/14/2015 15:55
Title: Re: How do I use SPI?

HI

THANKS.

COULD YOU PLEASE MENTIONED MORE ABOUT HOW I CAN USE GPIO/SPI . IT WILL BE PERFECT IF YOU JUST SEND ME ABOUT THE STEPS WHAT I HAVE TO

DO ...

THANKS IN ADVANCE


Author: LNX_HOBBY    Time: 2/14/2015 20:03
Title: Re: How do I use SPI?

Hi,

I as look on that, if I am not work , I have to download kernel source tree from here - https://bitbucket.org/T-Firefly/firefly-rk3288-kernel, after configuraing dts for gpio/spi I have to build it and install kernels and modules, Is that right?


Author: LNX_HOBBY    Time: 2/26/2015 05:39
Title: Re: How do I use SPI?

dear all,

I am little bit  confused about the firefly. I modified the  dts file inside the kernel source /arch/arm/boot/dts firefly-rk3288.dts.

My confusion is when kernel compiled will it take firefly-rk3288.dts or firefly-rk3288_beta.dts . Both have the same node i guess.

thanks


Author: lin_jc    Time: 2/26/2015 09:21
Title: Re: How do I use SPI?

hi LNX_HOBBY

it will take firefly-rk3288.dts when you compile kernel, if your board is hardware version 2014.09.30.






Welcome Firefly Open Source Community (https://bbs.t-firefly.com/) Powered by Discuz! X3.1