SPI Device driver programming

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI Device driver programming

5,463 Views
vijeshreddy
Contributor I

Hi ,

I have interfaced a 24bit ADC(sampling rate 52ksps) to phycore imx6 module via SPI. I have created a node in /dev - SPIDEV1.0. I have  written an spi driver in user space and reading the ADC using read() function.

I am able to read the adc, but since the driver was written in user space - read() function is taking a lot of time and  the samples are getting missed. I was advised to write the driver in kernel space instead of user space to resolve this issue.

I am new to linux and has no idea on device drivers.

My basic doubt is to know whether it is possible to read the ADC by writing my own device driver. Is it possible to do all buffering in kernel space and send it later to user space once all the samples are collected.

Please help me out, thanks in advance

0 Kudos
3 Replies

1,754 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Vijesh,

here you can find an example of a SPI driver in user space and in kernel space http://linux-sunxi.org/SPIdev 

You will find it very useful.


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,754 Views
marcingrzelak
Contributor I

Hi.

i try use this code http://linux-sunxi.org/SPIdev.

And i have problem:

spi: disagrees about version of symbol spi_sync
spi: Unknown symbol spi_sync (err -22)
spi: disagrees about version of symbol spi_new_device
spi: Unknown symbol spi_new_device (err -22)
spi: disagrees about version of symbol spi_busnum_to_master
spi: Unknown symbol spi_busnum_to_master (err -22)
spi: disagrees about version of symbol spi_setup
spi: Unknown symbol spi_setup (err -22)

What is wrong?

0 Kudos

1,754 Views
Carlos_Musich
NXP Employee
NXP Employee

check Interfacing FXLS8471Q with i.MX6Q 


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos