HCS12 SPI

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

HCS12 SPI

跳至解决方案
3,218 次查看
prog_ram
Contributor III

Hi,

I have two devices connected on one SPI Port. The first device is a flash memory that takes either Mode 0 or Mode 3 SPI waveform. The other device is a DAC that takes Mode 1 waveform.

 

The question is, can I have those two devices on the same SPI port?

The question implies ,of course, that I have to setup the SPI waveform (choose which mode to use) every time I communicate with either device. is that possible to do?or is that a "healthy" thing to do?

The flash memory is accessed every 1 second (minimum).

The DAC is accessed randomly.

 

Thank you,

 

Regards,

 

Prog_ram. 

标签 (1)
0 项奖励
回复
1 解答
1,573 次查看
bigmac
Specialist III

Hello Prog_ram,

 

I know of no adverse consequences for continuously enabling and disabling the SPI module.

 

With respect to the GPIO settings, this need be done once only after a POR, when all other GPIO pins, including the two SS signals, are normally initialised. These settings would apply whenever the SPI module is disabled, and would ensure always a defined (high) logic state for the MISO, MOSI and clock pins.  Whenever the SPI module is enabled, the module will automatically over-ride the underlying GPIO settings.

 

Regards,

Mac 

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,573 次查看
bigmac
Specialist III

Hello Prog_ram,

 

Following each data tranfer to one of the devices you might disable the SPI module, and then re-initialise the module just prior to every new transfer.  Of course you will need to have separate SS output signals to each device, and these should not be activated until after initialisation has taken place.

 

It makes sense to configure the three pins occupied by the SPI module as inputs when the module is disabled, and with internal pullups enabled.

 

Regards,

Mac 

0 项奖励
回复
1,573 次查看
prog_ram
Contributor III

Thanks Bigmac,

So, you're saying that it's OK to continuously changing the initialization of the SPI prrior to each data transfer to a different device?

The other thing, you said that I have to have the three pins of SPI internally pulled-up and inputs while SPI is disabled, do I need any sort of delay between the setting the pins and initializing the SPI?

 

thank you again.. 

0 项奖励
回复
1,574 次查看
bigmac
Specialist III

Hello Prog_ram,

 

I know of no adverse consequences for continuously enabling and disabling the SPI module.

 

With respect to the GPIO settings, this need be done once only after a POR, when all other GPIO pins, including the two SS signals, are normally initialised. These settings would apply whenever the SPI module is disabled, and would ensure always a defined (high) logic state for the MISO, MOSI and clock pins.  Whenever the SPI module is enabled, the module will automatically over-ride the underlying GPIO settings.

 

Regards,

Mac 

0 项奖励
回复
1,573 次查看
prog_ram
Contributor III

bigmac, it worked!!

 

Thank you. 

0 项奖励
回复