Change SPI Speed in Code

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

Change SPI Speed in Code

1,196 Views
barrypurtymun
Contributor II

Hello NXP,

I am using Kinetis Design Studio with a K60 chip.  I have a touch screen that needs to be initialized via SPI at 10 MHz or less.  The touch screen can communicate at 30 MHz after initialization. I have a bus clock speed of 60 MHz and need to change my SPI prescaler divider from 6 to 2 (10 MHz to 30 MHz) after I run my initialization code.  I used processor expert (SyncroMaster) to configure my SPI port.  Please advise how I should change my SPI bus speed after the touch screen has been initialized. 

Thank you. 

0 Kudos
1 Reply

678 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Barry Purtymun,

   After you initialized the SPI for the touch screen initialization, and want to use the higher spi baud, you can try to modify the SPI baudrate prescaler register directly.

  It is SPIx_CTARn[PBR], please use the register control directly on your code at first, just the test the function, whether it meet your demand.

If you still have question about it, please kindly let me know!

Have a great day,
Kerry

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

0 Kudos