MQX SPI on Kinetis with Multiple Devices

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

MQX SPI on Kinetis with Multiple Devices

562 Views
Vagni
Contributor IV

I am developing my application with CW 10.4 and MQX 4.0.2.

On my custom K60-based board I have 3 devices on the SPI0 bus: 2 data-flash memories and 1 SD card (on the last device I have to mount a file system).

The related chip-select are to be driven by software.

For the data-flash memories SPI0 has to be configured in Mode-3 with a baud rate, while the SD card needs a Mode-0 SPI configuration with another baud rate.

I have MQX sample code both for SPI driver for a single device and for SPI-base SD card driver with MFS file system.

But how can I handle my case?

Do I need to install one single SPI Driver for SPI0 and then open with _io_open() API call one file handle for each device and configure the transfer parameters of each file handle with _io_ioctl() call?

Is then automatic to have the right SPI0 configuration upon calling _io_read() or _io_write() with the specified file handle?

And how to handle chip-select on each data transfer?


Tags (2)
0 Kudos
0 Replies