AnsweredAssumed Answered

Using PCS1/2/3 on SPI0 - K64F Board

Question asked by Michael Koller on Apr 22, 2016
Latest reply on Apr 27, 2016 by Michael Koller

Hello!

I have a sensor that gives readings to the controller via SPI. It's working fine when I am using SPI0_PCS0, but I need more Chip Selects for multiple sensors, which gives me trouble.

I am using the SPI0, in my slightly altered KSDK dspi loopback example.

 

In main.c there is the masterUserConfig, that selects the Peripheral Chip Select (,of which SPI0 has 5, apparantly). It looks like this:

dspi_master_user_config_t masterUserConfig = {

        .isChipSelectContinuous     = false,

        .isSckContinuous            = false,

        .pcsPolarity                = kDspiPcs_ActiveLow,

        .whichCtar                  = kDspiCtar0,

        .whichPcs                   = kDspiPcs0

    };

 

Now I would assume, that changing kDspiPcs0 to kDspiPcs1 for example changes the used chip select and there is also the appropriate enum.

 

Next, I have to set the pin mux of the pinout, that is SPI0_PCS1. I found an excel sheet that lists all the different mux options for the K64F Board.

In the init, there is the command

PORT_HAL_SetMuxMode(PORTD,0u,kPortMuxAlt2);

which works fine and sets the mux mode of PortD0 to SPI0_PCS0.

When I insert

PORT_HAL_SetMuxMode(PORTC,3u,kPortMuxAlt2);

in my main or in the spi_configure function, which should activate the SPI0_PCS1 on PORTC3, without even changing anything else in the otherwise working code. The program doesn't run.

 

After this lengthy explanation, my question is:

Why doesn't this work as expected? Are not all mux modes on the processor available on the K64F Board?

Or do I miss something else?

 

I would assume it should be possible to communicate with multiple slaves with the SPI0 in master mode.

Best regards, any information helps,

Michael

Outcomes