FRDM-K82F SPI: How to change the chip-select pin for SPI-Master.

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

FRDM-K82F SPI: How to change the chip-select pin for SPI-Master.

1,024 Views
markushärtinger
Contributor I

Hi

I started with the dspi_blocking_example_master_frdmk82f, which worked pretty well for me.

So I connected a different board with kDspiPcs0 on SPI0.

But now I also want to connect a third borad also with SPI0 but chip-select kDspiPcs1 (PTD4).

It is clear for me I have to initalize this pin as SPI0_CS.

But my big problem is, how to change between the chip-selcts whithin the program code.

Due to my understanding DSPI_DRV_MasterTransferBlocking don't have a possibility for selecting the chipselect.

Till now I haven't found any siutable example for this problem.

Can someone give me some hints.

Thanks

Tags (1)
0 Kudos
Reply
2 Replies

906 Views
markushärtinger
Contributor I

Thanks for the answer!

This hint is great.

But for some reason there seams to be a problem with the kDSPI_MsbFirst.

If I send the data from one board to another board there are alsways to Bits mixed:

Send:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Recieved:

BADCFEHGJILKNMPORQTSVUXWZY

Any idea?

0 Kudos
Reply

906 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Markus Härtinger 

As I saw that you are using DSPI_DRV_MasterTransferBlocking, I can see that you are using SDK 1.3. I would like to recommend you to change to the new version of SDK (v2.x). You can download it in the page:

Welcome | MCUXpresso SDK Builder 

You can see that with these drivers you can change chipselect in a spi structure like

dspi_transfer_t masterXfer;

masterXfer.configFlags = kDSPI_MasterCtar0 | EXAMPLE_DSPI_MASTER_PCS_FOR_TRANSFER | kDSPI_MasterPcsContinuous;

Hope this could help you.

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply