Kinetis SPI Master Clock Polarity after Init

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

Kinetis SPI Master Clock Polarity after Init

ソリューションへジャンプ
3,138件の閲覧回数
Vagni
Contributor IV

I am developing my application on Kinetis K60 with CodeWarrior 10.1 with ProcessorExpert 5.1 and MQX 3.7.

I need to drive an SPI bus in master mode, so I use the SPIMaster_LDD embedded component.

 

I initialize clock polarity as HIGH and clock phase as CHANGE ON LEADING EDGE.

 

But after the execution of the SPI_Init() function the CLK pin is at LOW level. Why? The clock line idle state should be high.

 

For this reason, my first SPI Master transaction to the slave device (which requires a high clock idle state) always fails.

However, after the first SPI transaction the CLK pin remains high, so all the subsequent SPI transactions are good.

 

As a workaround, I make a dummy SPI transaction of a single data byte after the SPI_Init() function call and then I can get all the real subsequent transactions to work properly.

 

Does the Kinetis SPI peripheral initialization make the CLK pin output the correct idle level set by the chosen clock polarity?

 

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,898件の閲覧回数
ProcessorExpert
Senior Contributor III

Hello,

 

I have discussed the problem with developers and the behaviour of SPIMaster_LDD i correct and correspond to the description of DSPI device in reference manual (RM).

 

The parameters of the communuicaiton are set during data transfer. For more details please see section: "49.3.7 DSPI PUSH TX FIFO Register In Master Mode (SPIx_PUSHR)" in RM. 

 

So, it seems your workaround was correct.

 

best regards
Vojtech Filip
Processor Expert Support Team

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,898件の閲覧回数
sgraves
Contributor I

Even though this thread is long dead, I would like to correct the information in threads like these for those who are googling for solutions to various problems.  So this comment is for future googlers, not the original participants.

This thread demonstrates an often confused understanding of the clock polarity settings.  If the clock setting is active high then it will idle low.  So the clock was behaving correctly for the chosen setting.  If one wants an idle high and clocking on the rising edge (a very common SPI configuration) then the choices should be ACTIVE LOW and CLOCK ON SECOND EDGE.

0 件の賞賛
返信
1,898件の閲覧回数
ProcessorExpert
Senior Contributor III

Hello,

 

I am not aware of such problem in SPIMaster_LDD component. Could you please provide the ProcessorExpert.pe file from your project in order to analayze it?

 

best regards
Vojtech Filip
Processor Expert Support Team

0 件の賞賛
返信
1,898件の閲覧回数
Vagni
Contributor IV

Hello Filip,

 

See my attached ProcessorExpert.pe file.

 

Thank you.

0 件の賞賛
返信
1,899件の閲覧回数
ProcessorExpert
Senior Contributor III

Hello,

 

I have discussed the problem with developers and the behaviour of SPIMaster_LDD i correct and correspond to the description of DSPI device in reference manual (RM).

 

The parameters of the communuicaiton are set during data transfer. For more details please see section: "49.3.7 DSPI PUSH TX FIFO Register In Master Mode (SPIx_PUSHR)" in RM. 

 

So, it seems your workaround was correct.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 件の賞賛
返信