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.

Question regarding SPI

Hi,

I am working EVMC6678l.

I have a question regarding SPI control register.

To use SPI, I am using platform library.

In evmc66x_spi.c when I use SPI, every time all SPI registers are initialized.

without initializing registers, can I use SPI CS0 and CS1?

And what is the difference between SPIFMT0, SPIFMT1, SPIFMT2 and SPIFMT3?

Thanks in advance.

Baeyoung

  • Hello Baeyoung,

    Yes, the SPI registers need to be initialized every time for proper communication. The difference between SPIFMT0, SPIFMT1, SPIFMT2 and SPIFMT3 is the chip select, the number appears at the end shows for which chip select the register belongs to.

    Regards,
    Senthil
  • Dear Senthil,
    Thanks for your answer.
    Do you mean that SPIFMT0 is for CS0, SPIFMT1 for CS1, SPIFMT2 for CS2 and SPIFMT3 for CS3? Is it right?
    I am using platform library provided by MCSDK. The version is like the follwoing.
    mcsdk_2_01_02_06
    pdk_C6678_1_1_2_6
    For FPGA control and NOR flash, spi_claim() is used. The file is evmc66x_fpga.c
    NOR flash is using SPI CS0 and FPGA is using SPI CS1.
    For both CS0 and CS1, SPIFMT0 is set by spi_claim().
    SPIFMT1 is not used ever. Can you make it clear?
    To differentiate CS0 and CS1, SCSFUN of SPIPC0 is set respectively for CS0 or CS1. Is it right?
    I think that if SPIFMT0 is used for CS0 and SPIFMT1 is used for CS1, I only need to set SCSFUN for CS0 or CS1 without initializing SPI registers. Is it right?
    Please help me.
    Thanks in advance.
    Baeyoung
  • Hello Baeyoung,

    Sorry for the misinterpretation. The number mentioned in the SPIFMTn register does not mean the chip select number. There are four SPIFMT registers available to set the different data format and you could program any SPIFMT register to a chip select. The SPIFMT register can be programmed in SPIDAT1.DFSEL register. The programmed data format register will be applicable for the chip select programmed in the SPIDAT1.CSNR field.

    To differentiate CS0 and CS1, SCSFUN of SPIPC0 is set respectively for CS0 or CS1. Is it right?
    I think that if SPIFMT0 is used for CS0 and SPIFMT1 is used for CS1, I only need to set SCSFUN for CS0 or CS1 without initializing SPI registers. Is it right?

    The SCSFUN of SPIPC0 defines the number of chip selects available for SPI interface. It does not mention which chip select you are using for the particular SPI interface. Please refer above explanation on SPIFMT and chip select.

    Regards,

    Senthil

  • Dear Senthil,
    Thanks for your answer.
    I assme SCSFUN select CS0 or CS1. And I think you misspelled the follwoing sentence:
    "It does not mention" => "It does mention"
    Am I correct?
    Thanks a lot.
    Baeyoung
  • Hello Baeyoung,

    There is no misspelling in my statement. The SCSFUN[n] field states whether you are using the respective chip select for SPI interface or leaving it as reserved. The SPIDAT1.CSNR register only defines which chip select is used for SPI interface.

    Regards,
    Senthil
  • Dear Senthil,

    I appreciate your detailed answer.

    I got what you explined. SPI register configuration is different from what I programmed.

    Based on CSNR, SPI CS can be active high. It's interesting.

    Thanks a lot.

    Baeyoung