FRDM-K64F SPI communication

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

FRDM-K64F SPI communication

1,124件の閲覧回数
darshan_shah1
Contributor II

Hi,

I am referring freertos_dspi for SPI communication yet I don't find a way to manually select the chip and change the respective configuration in dspi_transfer_t.

I would like to send/receive multiple bytes data with manually selecting CS pin for interfacing external flash.

Please help me.

ラベル(1)
タグ(2)
3 返答(返信)

1,019件の閲覧回数
diego_charles
NXP TechSupport
NXP TechSupport

Hi Darshan_The_Geek

I hope you are doing well, 

 You don't need to manually select the PCS (chip select signal )

The SPI peripheral handles that for you.  In the example the PCS signal is asserted during all the master transfer. 

 masterXfer.configFlags = kDSPI_MasterCtar0 | kDSPI_MasterPcs0 | kDSPI_MasterPcsContinuous;

to help you further, do you need to change this behaviour of PCS? 

The dspi_transfer_t  structure should have the pointers to the transmit and transmit buffers before each master transfer. Please, let me know your desired configuration

 If you need more reference examples you can check  dspi_polling_b2b_transfer_master,  which initializes only the SPI master instance.However does not use any RTOS.

Best regards, Diego. 

0 件の賞賛
返信

1,019件の閲覧回数
darshan_shah1
Contributor II

Hi Diego,

Thank you for your response.

Yes I would like to change this behaviour. I would like to manually select chip select pin.

I am using RTOS SPI transfer code and I would like to use the same.

Can you guide me how to select manually CS pin? What if I do not mention PCS pin in pin mux?

0 件の賞賛
返信

1,019件の閲覧回数
diego_charles
NXP TechSupport
NXP TechSupport

Hi Darshan_The_Geek‌,

I'm glad to help you!

What is the chip select format that you desire to implement?

Please, check the following pictures. They  ilustrate the automatic  behaviour of the dedicated PCS pin of the K64  (more details on the reference manual)

continous selection.png

  • Left, Continous transfer :default behaviour od PCS pin using the SDK example,
  • Rigth, Non continous format : obtained after deleting  kDSPI_MasterPcsContinuous macro from the following sentence on the SDK example.

masterXfer.configFlags = kDSPI_MasterCtar0 ;// to obtain non continous format

Since the assertion on the dedicated chip select pin (PCSx ) of the K64 is done automattically by the SPI peripheral during transactions. If you like to manually control the chip select on your slave device to have a different format ,  setting a GPIO pin as chip select may result more easy.

Please, let me know if I understand correctly what do you mean by manually controlling CS pin.

Best regards, Diego.