SPI MQX 3.6

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

SPI MQX 3.6

1,123 Views
JaimeR
Contributor III

Hi,

 

I have a doubt concerning SPI driver, this is the situation:

 

-MCF52259

-MQX 3.6

-I need to control 3 SPI devices, one of the uses QSPI_PCS0 Pin and the other two devices use GPIO.

 

I understand I must use IO_IOCTL_SPI_SET_CS_CALLBACK  in order to call a customized function and control Chip Select automatically.

 

Does this mean I must open 3 SPI drivers so that I can use a specific routine to control each chip select pin? or

How do I indicate which pin should the callback function activate/deactivate?

 

I already checked the SPI example but since it only used ONE spi device I don't know how to indicate which device should be active.

 

Thank you

 

0 Kudos
Reply
1 Reply

541 Views
PetrM
Senior Contributor I

The relation is 1 SPI driver <=> N SPI devices.

Check the spi example again, search for "callback". You can extend this section for more callbacks and/or CSs.

There's a MASK for every callback function, which is bitfield of CS definitions passed to IO_IOCTL_SPI_SET_CS.

So when you IO_IOCTL_SPI_SET_CS in the runtime, matching CS callback will be called.

You can use MCF5XXX_QSPI_QDR_QSPI_CS0-3 CS bit definitions in the mask/ioctl.

 

PetrM

 

0 Kudos
Reply