How to get SPI devices on a FRDM-LS1012A?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get SPI devices on a FRDM-LS1012A?

1,005 Views
Contributor II

Hi, I have an FRDM-LS1012A and flashed the latest 32Bit image onto it

I found no way to enable the SPI devices in Linux yet. I tried

modprobe spidev

but nothing happens, not even an error.

So how can I enable the SPI devices?

Labels (1)
Tags (1)
7 Replies

112 Views
Contributor II

Hi, thx for the response but I think you did not understand my issue. I'm specifically asking about SPI access under Linux! That implies that I can boot from the QSPI attached flash, so that is not my problem.

I just want to access the other SPI bus and attach a device through the arduino compatible headers.

BG

0 Kudos

112 Views
NXP TechSupport
NXP TechSupport

I see  certain confusion in this discussion thread, let me step in.

Available on Arduino connector of LS1012A-FRDM is DSPI, not QSPI.  It is correct that DSPI driver is

enabled in the SDK default kernel configuration, but if you look at the SDK Device Tree for this board,

you will find "status  =  disabled", so the bus controller driver loads, but does nothing. You should change

it to "status  =  ok" at the first step and rebuild.

Second, SPI is not a plug-and-play bus. Devices are not detected automatically, loading spidev module is

not sufficient. The same SDK Device Tree specifies no device on SPI bus. If you wish to connect an SPI

peripheral to Arduino connector, declare the device in the Device Tree as a  child of the dspi SPI bus and rebuild.

Take a look at fsl-ls1012a-qds.dts to see how SPI peripherals are declared.

For spidev driver,  it should be sufficient to specify 'reg' and 'compatible = "spidev"' device node properties. If you have a

specific driver for your SPI peripheral, consult at the driver documentation or source code on what properties

it expects.

More information ca be found in

/Documentation/spi/spidev

/Documentation/devicetree/bindings/spi/spi-bus.txt

/Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt


Have a great day,
Platon

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

112 Views
Contributor II

Hello Platon,

yes, that explains it all!

No worries about my device, it has a user space driver, so in theory I only need to enable it in the DT.

There is really no other way like enabling it from u-boot or after the system has booted?

If not, I have to modify the DT and build an image using the SDK as described in the 

QorIQ-LS1012A-SDK-v0.4.pdf document, correct?

BG, Thomas

0 Kudos

112 Views
NXP TechSupport
NXP TechSupport

u-Boot and Linux have separate and independent SPI drivers. You can talk to your devices in u-Boot, but Linux

will reinitialize the bus anew. I do not see any way to configure it in Linux in runtime without the changes I described above.


Have a great day,
Platon

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

0 Kudos

112 Views
Contributor II

Hi Platon,

ok, very clear.

What is the quickest way to get your proposed changes? I have to build a new image to be flashed I guess?

BG, Thomas

0 Kudos

112 Views
NXP TechSupport
NXP TechSupport

Hello Thomas Hoppe,

Previous I considered you wanted to access DSPI.

QSPI is enabled by default in Linux Kernel and u-boot, please download and use the latest SDK 2.0  1703 release.

First under u-boot, please check QSPI can be detected.

=> sf probe 0:0
SF: Detected S25FS512S_256K with page size 512 Bytes, erase size 256 KiB, total 64 MiB

Then check the following message displayed in Linux Kernel boot log.

[    0.856290] fsl-quadspi 1550000.quadspi: s25fs512s (65536 Kbytes)

If you cannot found the above message, please check the Kernel configuration as the following.

 Device Drivers ---> 

[*] SPI support --->

<*> Memory Technology Device (MTD) support --->

Self-contained MTD device drivers --->

<*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)

        <*>   SPI-NOR device support  --->

                 <*> Freescale Quad SPI controller


Have a great day,
TIC

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

0 Kudos

112 Views
NXP TechSupport
NXP TechSupport

Hello Thomas Hoppe,

I checked FRDM-LS1012A  dts and Kernel configuration file, SPI is enabled by default.

I suspect you didn't configure RCW correctly to enable SPI, please refer to the following RCW definition from LS1012A Reference Manual, SPI pins are multiplexed with SDHC, so please configure these fields as "11" to support SPI.

pastedImage_1.png

Please use the command "sf probe" under u-boot to check whether SPI devices can be detected successfully.

If your problem remains, please provide your u-boot and Linux Kernel booting up log.


Have a great day,
TIC

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

0 Kudos