Configuring Master SPI Bus Speeds via PEx?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Configuring Master SPI Bus Speeds via PEx?

ソリューションへジャンプ
1,404件の閲覧回数
tharonhall
Contributor IV

I am using a K22F part and I need to configure the SPI bus in Master mode. In PEx under KDS, when I go to the spiCom1 component, and under the "Master mode" tab I can setup bus configurations. There is a "Clock rate" column that allows one to set up the clock rate. You can click on the value shown and get an button that takes you to a "Timing dialog - spiCom1/Clock rate" window. You can choose values based on 5 clock configurations. However, I don't know what is setting those clock configurations, and anything above 2.14MHz gives me an error, even though higher frequencies are listed.

I suspect I need to tweak the clock configurations, but I cannot locate where they are set. The modules references an fsl_clock_manager, but when I go there I don't see anything that actually sets up clock configurations.

Can anyone tell me where those are set up?

Thanks!

タグ(3)
0 件の賞賛
返信
1 解決策
1,183件の閲覧回数
tharonhall
Contributor IV

OK, for anyone that might read this one, I figured this out today:

I created my project from an example project for the K22F Freedom board. For whatever reason, the project came with several clock configurations. I switched the init clock config to the fast runtime configuration and away things went. That was all fine and good, but I still couldn't get the SPI bus above 2.1 MHz.

It turns out that even though I was only using the one clock configuration, the PEx SPI module, in its desire to be helpful, freaked out that there were clock configurations that would not work with the higher speeds if I chose to use it. Now, I disagree with that approach since I could have clock configurations that I might run that I would NOT use SPI on, and PEx was denying me the opportunity.

Rather than risk anything breaking by deleting any of the unused clock configurations, I simply set them all to high speed and viola, I can now clock at much higher frequencies. :smileyhappy:

Of course, none of this helps explain why my soft SPI code is SO unbelievably slow. :smileysad:

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,183件の閲覧回数
dereksnell
NXP Employee
NXP Employee

Hi Tharon,

The clock configurations are part of the properties in the CPU component, and define the system clock frequencies used by the core and peripherals.  See screenshot below

Attached is a hands-on lab I created recently, dealing with the clock configurations within Processor Expert, and how it relates to peripheral setup. This lab was written for the IAR toolchain, but the Processor Expert steps are the same for any toolchain, including KDS.  So you can ignore the section on the IAR project.

Thanks


Clock Configs.jpg

1,184件の閲覧回数
tharonhall
Contributor IV

OK, for anyone that might read this one, I figured this out today:

I created my project from an example project for the K22F Freedom board. For whatever reason, the project came with several clock configurations. I switched the init clock config to the fast runtime configuration and away things went. That was all fine and good, but I still couldn't get the SPI bus above 2.1 MHz.

It turns out that even though I was only using the one clock configuration, the PEx SPI module, in its desire to be helpful, freaked out that there were clock configurations that would not work with the higher speeds if I chose to use it. Now, I disagree with that approach since I could have clock configurations that I might run that I would NOT use SPI on, and PEx was denying me the opportunity.

Rather than risk anything breaking by deleting any of the unused clock configurations, I simply set them all to high speed and viola, I can now clock at much higher frequencies. :smileyhappy:

Of course, none of this helps explain why my soft SPI code is SO unbelievably slow. :smileysad:

0 件の賞賛
返信
1,183件の閲覧回数
tharonhall
Contributor IV

Thanks, Derek. This threw me as I would have expected the clocks in a clock peripheral of some kind, so thank you for pointing me in the right direction. I did some quick and dirty tweaks and couldn't get the speed shifted up but now that I know where to look I am sure I can unravel the mystery.

Thanks again!

0 件の賞賛
返信