This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-F28379D: SPI Mode Configuration in Delfino LAUNCXL- F28379D

Part Number: LAUNCHXL-F28379D

Tool/software: Code Composer Studio

Hello everybody,

I am trying to become acquainted with SPI communication with LAUNCHXL F28379D launchpad and I want to clarify something regarding the SPI Mode configuration that I am using. If I want to communicate with an external device through SPI that is configured for SPI Mode 3(Clock Polarity =1 and Clock Phase = 1) then shouldn't I initialize SPI inside my stack like this?

SpixRegs->SPICCR.bit.CLKPOLARITY = 1; // Rising edge
SpixRegs->SPICTL.bit.CLK_PHASE = 1; //

Doesn't it guarantee SPI Mode 3?

Thank you in advance

Stamatis 

  • Hi Stamatis,

    You will need to compare the clock and phase settings in the C2000 reference manual with the product you are communicating with. Note that manufacturers may define PHASE and POLARITY differently, so SPI mode 3 on one device may be different on another part.

    Regards,
    Kris
  • Thank you for the response,
    I have checked it with my other device and I have programmed it to receive and send with SPI Mode 3 which means clock phase=1 and measurement in the rising edge of the clock which means clock polarity =1 as well. Yet the aforementioned configuration in my C2000 launchpad doesn't correspond to this specific configuration. To be more specific if i want to communicate with a device via SPI that is programmed fro clock phase =1 and clock polarity=1(as explained earlier), how should I initialize my LAUNCHXLF28379D launchpad for the same configuration. Because the following doesn't work while it should have been working from what i infered from the datasheet!

    SpixRegs->SPICCR.bit.CLKPOLARITY = 1; // Rising edge
    SpixRegs->SPICTL.bit.CLK_PHASE = 1; //

    Thank you
  • On the other hand,
    SpixRegs->SPICCR.bit.CLKPOLARITY = 1; // Rising edge
    SpixRegs->SPICTL.bit.CLK_PHASE = 0; //
    is configured correctly and communicates in SPI 3 mode. Can you explain why this is happening? Shouldn't they both be "1" for SPI Mode 3?
    Thank you
  • Hi Stamatis Athiniotis,

    Different manufacturers may define clock settings differently than others. We do offer figures describing our phase and polarity settings in the TRM available here:

    Figure 18-11 would be a good place to start.

    Regards,

    Kris