FLEXIO as SPI configuration

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

FLEXIO as SPI configuration

Jump to solution
2,389 Views
gschelotto
Contributor V

Hi,

I'm evaluating FLEXIO as SPI using SDK v3.2.1 on a FRDM-KL27Z. Basically I'd need to solve 2 things:

  • Set the CLK Polarity Active Low, not High as provided in the frdmkl27z_driver_examples_flexio_flexio_spi_int_spi_transfer_master
  • Disable CS assertion by the driver. I need to set/clear the CS manually. Similar way than the output mode configuration (kSPI_SlaveSelectAsGpio) in the SPI driver.

How can I do to accomplish these points?

regards,

gaston

0 Kudos
Reply
1 Solution
1,667 Views
gerardo_rodriguez
NXP Employee
NXP Employee

Hi Gaston,

Yes, the FlexIO SPI driver must be modified to invert the clock polarity.

Unfortunately, I don't know if this feature will be implemented in future versions of the SDK.

Regards,

View solution in original post

0 Kudos
Reply
5 Replies
1,667 Views
HeMyFAE
NXP Employee
NXP Employee

HI Gerardo,

Can you check with the SDK team on whether we have implemented FlexIO SPI driver with the ability to invert the clock polarity for i.xm RT 10xx?

Regards,

hy

0 Kudos
Reply
1,667 Views
gerardo_rodriguez
NXP Employee
NXP Employee

Hello Gaston,

The FlexIO SPI driver doesn't support CPOL=1 (idle high), but as mentioned in the KL27P64M48SF2RM, you can manually change the pin polarity of the timer used for SCK generation to support this:

pastedImage_1.png

In FLEXIO_SPI_MasterInit(): 

    /*3. Configure the timer 0 for SCK. */
    timerConfig.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(base->shifterIndex[0]);
    timerConfig.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
    timerConfig.triggerSource = kFLEXIO_TimerTriggerSourceInternal;
    timerConfig.pinConfig = kFLEXIO_PinConfigOutput;
    timerConfig.pinSelect = base->SCKPinIndex;
//    timerConfig.pinPolarity = kFLEXIO_PinActiveHigh;
    timerConfig.pinPolarity = kFLEXIO_PinActiveLow;

About the CS pin, you can manually change the pin muxing to GPIO instead of the FlexIO so you can manually control it. 

Regards,

Gerardo

0 Kudos
Reply
1,666 Views
gschelotto
Contributor V

Hi Gerardo,

Thanks for replying. I assume I have to modify the FlexIO SPI driver in order to change the pin polarity of the timer. Will this feature be implemented in the next SDK version?

regards,

gaston

0 Kudos
Reply
1,668 Views
gerardo_rodriguez
NXP Employee
NXP Employee

Hi Gaston,

Yes, the FlexIO SPI driver must be modified to invert the clock polarity.

Unfortunately, I don't know if this feature will be implemented in future versions of the SDK.

Regards,

0 Kudos
Reply
1,667 Views
gschelotto
Contributor V

Please could someone give me some feedback? I thought I could use an extra SPI interface without constraints but I don't know how to do it.

https://community.nxp.com/thread/471557 

regards,

gaston

0 Kudos
Reply