HCS12 SPI

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

HCS12 SPI

Jump to solution
2,650 Views
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. 

Labels (1)
0 Kudos
Reply
1 Solution
1,005 Views
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 

View solution in original post

0 Kudos
Reply
4 Replies
1,005 Views
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 Kudos
Reply
1,005 Views
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 Kudos
Reply
1,006 Views
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 Kudos
Reply
1,005 Views
prog_ram
Contributor III

bigmac, it worked!!

 

Thank you. 

0 Kudos
Reply