FRDM-K64F SPI communication

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

FRDM-K64F SPI communication

780 Views
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.

Labels (1)
Tags (2)
3 Replies

675 Views
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 Kudos

675 Views
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 Kudos

675 Views
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.