different chipselect selection for SPI

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

different chipselect selection for SPI

1,544 Views
lijofrancis
Contributor III

hai sir,

i am using K60 tower board .if i am using different chipselect how to set baudrate,cpol,cpha for different chipselect.

there is only one register for baudrate select. so each time at running state i cant chenge this regiser so how to set for different chip select

5 Replies

899 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Lijo Francis:

You can change configurations between transfers by using the SPIx_CTARn registers. Then from the SPIx_PUSHR register as stated by Mark you would select the slave to communicate with as well as the CTAR to use with the field SPIx_PUSHR[CTAS]. Refer to SPI chapter in Reference Manual for more details about CTAR registers. If you have further doubts please let us know.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

899 Views
lijofrancis
Contributor III

hello sir

actually i asked because some controller has register for each chipselect.but there is only one CTAR register.There is

Do not write to the CTAR registers while the module is in the Running state.there for we have to stop spi then change CTAR then restart spi .that option available only for this so is there is any other options.i wrote code for spi that is working.but if am using one spi with different chip select i have to change ctar register .is it required to stop spi and load new one

0 Kudos

899 Views
Amit_Kumar1
Senior Contributor II

Hi Lijo

As Earl mentioned, U can make use of 2 SPI configurations using 2 CTARs supported by each SPI module as per the K60 Manual. I think this seems to resolve your issue. Did u get a chance to try it out ?

Regards

Amit

0 Kudos

899 Views
egoodii
Senior Contributor III

Here is what I see.  In section 3.9.4.3 of the K60 Reference Manual:

This device supports two CTARs on all instances of the SPI.

So you have two sets of control-timing you can select between (SPIx_CTAR0 & SPIx_CTAR1) for each SPIx_PUSHR operation, which may indeed be 'fewer' than the available CS selections in a SPI instantiation.

899 Views
mjbcswitzerland
Specialist V

Hi

The chip select is controlled by the value in the SPIn_PUSHR register so you can control the CS used on a byte basis.

The CS setting in SPIn_MSR controls whether it is active '0' or active '1' but not how it is actually used when sending data.

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market