How do you change SPI speed after it's set?

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you change SPI speed after it's set?

292 Views
Senior Contributor II

Hey gang,

 

I am making progress with my Kinetis/KSDK 1.3/PE 3.0.2 SD Card software for SPI on a FRDM-K22F Board (going to a custom K22 board in the future). 

 

One question, how do I increase the SPI speed after I set it originally using the DSPI_DRV_MasterConfigureBus (I'm using Interrupt based SPI right now) to 375kbps?  After the card is initialized, I should be able to run it at a faster data rate. 

 

I want to run at at least 10 MHz. 

 

I'm using a K22F and when I look at the SPI clocking options in PE, I see that the maximum (using the default Clock cfg.4) is 2.4 MHz although that's "From" and "To" says 12 MHz.  Can anybody explain this?

 

I am hoping to publish my software here in a few days.

 

 

Thanx,

 

myke

Labels (1)
0 Kudos
4 Replies

1 View
NXP TechSupport
NXP TechSupport

Hello myke,

I check on my side , the  clock rate of spi can configured to 10MHZ, and could you please show your project , and how about your

bus clock of mcu, the clock source of SPI is the bus clock .

pastedImage_0.png

And i recommend you do not change the speed when run the project , it maybe cause unpredictable problems .

Hope it helps

Alice

0 Kudos

1 View
Senior Contributor II

Hi Alice,

Thank you for the reply - to change the speed in the application, I found that re-running "DSPI_DRV_MasterConfigureBus" when I wanted to change the speed worked for me. 

By doing this on a FRDM-K22F, I found that the maximum speed that I seemed to be able to change the stock hardware to is 4.8 Mbps.  I haven't pushed it to 10 Mbps or looked at changing the internal clocking information. 

myke

0 Kudos

1 View
NXP TechSupport
NXP TechSupport

Hello myke,

So your problem have been solved ?

BR

Alice

0 Kudos

1 View
Senior Contributor II

Hi Alice,

Yes it has, I am calling the DSPI_DRV_MasterConfigureBus API to change the speed before initializing the SD Card and then increase the speed after initializing the card.

myke

0 Kudos