Need help: SPI with 10 devices attached

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

Need help: SPI with 10 devices attached

1,562 Views
Byra
Contributor I

Hi, Im brand new to MQX and the 52259. I have an application that has 10 devices attached to the SPI0 bus. Each has its own chip select, generated by a decoder (74154 type). The decoder inputs are connected to the 3 dedicated qspi CS pins plus a gpio pin, giving it the ability to select up to 16 different devices. In the MQX UG section about the SPI, all it says is that the QSPI chip selects are handled automatically and that the IO_IOCTL_SPI_SET_CS_CALLBACK function does not apply to this mcu.

 

How do I set it up so that when I write/read the SPI, it will automatically output the CS I need? Even if I have to do it manually that would be ok, but I dont see how to do that either.

 

Thanks,

 

Byra

0 Kudos
6 Replies

528 Views
CJr
Contributor I

Hi,

 

Please, for your application, did you have to change the SPI driver ? Does SPI devices have the same configuration ?

 

Thanks!

0 Kudos

528 Views
PetrM
Senior Contributor I

Different devices = different protocols. You have to find datasheet to your device, set the SPI driver accordingly (baudrate, bits per frame etc.) and write the particular communication protocol using SPI driver.

 

PetrM

 

0 Kudos

528 Views
PetrM
Senior Contributor I

Hello,

 

GPIO CS callbacks are now available for all SPI modules. Sorry for confusion.

This is what you need to do in your case.

Don't forget to open GPIO driver pins after opening SPI to overwrite pin configuration to GPIO mode.

 

PetrM

 

0 Kudos

528 Views
Joe2
Contributor II

Hi PetrM

 

I'm trying to do the same thing.

 

Is there an example anywhere of the use of GPIO CS callbacks?

 

Joe

0 Kudos

528 Views
PetrM
Senior Contributor I

Yes, the SPI example in mqx\examples directory includes the use of GPIO callbacks, it's just not used on all boards (see the enable defines in the example code).

 

PetrM

 

0 Kudos

528 Views
Joe2
Contributor II

Thanks, PetrM, that's great.  The example looks very clear.

 

Joe

 

0 Kudos