Firefly Open Source Community

   Login   |   Register   |
New_Topic
Print Previous Topic Next Topic

How do I use SPI?

26

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
26
Posted at 2/9/2015 12:29:27        Only Author  1#

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?

Reply

Use props Report

59

Credits

10

Prestige

12

Contribution

registered members

Rank: 2

Credits
59
Posted at 2/12/2015 11:00:01        Only Author  2#

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.

Reply

Use props Report

2

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
2
Posted at 2/14/2015 06:10:40        Only Author  3#

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

Reply

Use props Report

244

Credits

0

Prestige

0

Contribution

intermediate

Rank: 3Rank: 3

Credits
244
Posted at 2/14/2015 07:57:32        Only Author  4#

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.

Reply

Use props Report

2

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
2
Posted at 2/14/2015 15:55:33        Only Author  5#

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

Reply

Use props Report

2

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
2
Posted at 2/14/2015 20:03:08        Only Author  6#

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?

Reply

Use props Report

2

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
2
Posted at 2/26/2015 05:39:50        Only Author  7#

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

Reply

Use props Report

59

Credits

10

Prestige

12

Contribution

registered members

Rank: 2

Credits
59
Posted at 2/26/2015 09:21:37        Only Author  8#

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.

Reply

Use props Report

You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list