Need help: SPI with 10 devices attached

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Need help: SPI with 10 devices attached

2,573 次查看
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 项奖励
回复
6 回复数

1,539 次查看
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 项奖励
回复

1,539 次查看
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 项奖励
回复

1,539 次查看
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 项奖励
回复

1,539 次查看
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 项奖励
回复

1,539 次查看
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 项奖励
回复

1,539 次查看
Joe2
Contributor II

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

 

Joe

 

0 项奖励
回复