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/TMS570LS0432: M95256 EEPROM on SPI3

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN, TMS570LS1224

Tool/software: Code Composer Studio

I have interfaced SPI 3 of TMS570LS0432 with external SPIEEPROM. When i'm executing the code in code composer studio, i can see that the response for EEPROM commands is visible on MISO pin on oscilloscope but the Spi->Buf is showing default value (0x0000FFFF) for all the commands. When observing MISO(blue signal in below image) on oscilloscope, the signal remain low even after clock is disabled.

  • Hello,
    Check whether PINMUX and port configurations are set.
    Also, check whether SPI Clocking Modes of MCU are same as the EEPROM clocking modes - polarity and phase.

    For TMS570LS0432:



    Best regards,
    Miro

  • I have configured SPI3 with following values:

    spiREG3->GCR0 = 0U;                                        /* Global Control Register 0 = 0 SPI is in the reset state. */

    spiREG3->GCR0 = 1U;                                        /* Global Control Register 0 = 1 SPI is out of the reset state. */

    spiREG3->GCR1 = 0x00000003U;                 /* Global Control Register= SPI not Activated for Transfer, Master mode =1, (PowerDown)SPI active Mode = 0 , CLKMode = 1 (Clock is internally-generated)*/

    spiREG3->INT0 = 0x00000000U;                               /* SPI1 Interrupt Register- SPIENA pin is pulled high*/

    spiREG3->DELAY = 0x00000000U;                            

    spiREG3->FMT0 = 0x00004F10U;                               /* SPI clock signal is not delayed, Baudrate = (80Mhz/79+1) = 1Mh, SPI Data Format Registers 0:CHARLEN 16U (data word length = 16)*/

    spiREG3->FMT1 = 0x00004F08U;                               /* SPI clock signal is not delayed, Baudrate = (80Mhz/79+1) = 1Mh, SPI Data Format Registers 0: CHARLEN 16U (data word length = 8)*/

    spiREG3->LVL = 0x00000000U;                                /* Interrupts are mapped to INT0, but not enabled */

    spiREG3->FLG |= 0xFFFFU;                                   /* Clear any pending interrupts (writing 1 clears any flag) */

    spiREG3->INT0 = 0x00000000U;                               /* No interrupt enabled */

    spiREG3->PC3 = 0x0000000FU;                                /* ********SPI1 Port output values- Pin Control Register 0 *//* initialize  SPI1  Port */

    spiREG3->PC1 = 0x0000060FU;                                /* SPI1 Pin direction CS- output, CLKDIR = output, SIMODIR0 =output ,SOMIDIR0=Input*/

    spiREG3->PC6 = 0x00000000U;                                /* SPI1 Port open drain enable for all pins */

    spiREG3->PC8 = 0x00000F0FU;                                /* Pullup select for CS pins, pulldown selection, PullUp = CLK,MISO,MOSI */

    spiREG3->PC7 = 0x00000000U;                                /* SPI1 Port pin pull control enabled for all pins */

    spiREG3->PC0 = 0x00000F0FU;                                /* Set pins function to SPI= CS,MISO,MOSI,CLK */

    I have checked all the combinations of clock polarity and phase. Here, i can see data on MISO line only when polarity=0 and phase=1 and vice versa. But in data sheet of EEPROM the given combinations are 00 or 11 for polarity and phase.

    But for the given combinations i'm not getting output at MISO pin. I'm using CS0 pin.

  • Hello,
    While setting polarity and phase follow the description from both datasheets and set them according to description. You should set Hercules with polarity=0 and phase=1 while M95256 is in CPOL=0 and CPHA=0.

    Best regards,
    Miro
  • Hi Miro,

    I have set the same polarity and phase but i was not receiving data for Read Status Register command. When i pulled down the MOSI pin and disabled the pull control of it, i have started receiving data in my SPI Rx_Buf. But still i'm not getting data in the buffer when i'm sending Read from Memory Array command. I can see this command on oscilloscope. But i'm not receiving any data for it.

    Can you suggest something for this.

  • Hello,
    Please, make all unused pins of SPI3 not functional (set all unused SPI3 pins ( SPI3ENA, SPI3CS3,2,1 )as GIO). You can do this in HALCoGen SPI3->SPI3 Port tab. From post above i can see all CS are functional as well ENA pin.
    Go to PINMUX tab in HALCoGen and select SPI3 checkbox.

    Best regards,
    Miro
  • Hi,

    I have made all the unused pins as GIO pins but still i'm not receiving any data after read from memory operation.

  • Hello,
    Is it possible to attach your HALCoGen project (*.dil and *.hcg files) as well your code for sending/receiving data.

    Best regards,
    Miro
  • This are the new spi3 configurations after removing the configuration of unused pins(CS1,2,3 and SPIENA): 

    spiREG3->PC3 = 0x00000F01U; /* SPI3 Port output values-CS0,SOMI,clk pins are at logic 1, SIMO is at logic 0 */
    spiREG3->PC1 = 0x00000701U; /* SPI3 Pin direction CS- output, CLKDIR = output, SIMODIR0 =functional, SOMIDIR0=input */
    spiREG3->PC6 = 0x00000000U; /* SPI3 Port open drain enable for all pins */
    spiREG3->PC8 = 0x00000201U; /* Pullup selection for CS0,CLK pins, Pulldown selection = MISO,MOSI */
    spiREG3->PC7 = 0x0000050EU; /* SPI3 Port pin pull control enabled for CLK,CS0,MISO */
    spiREG3->PC0 = 0x00000E01U; /* Set pins function to SPI= CS,MISO,MOSI,CLK */

    Is this configurations are correct if i'm using CS0 pin only?

  • Hello,
    Do you have progress with this issue?
    If it is possible, attach your HALCoGen project (*.dil and *.hcg files) as well your code for sending/receiving data.

    Best regards,
    Miro
  • Hi,

    I have attached EEPROM instructions sequence as well as spi initialization that i have configured.

    Thanks,

    Amruta

    7142.eeprom_Read&Write.docx

  • Hi Miro,

    Still i didn't find any solution for this issue. Can you suggest anything on this?

    Thanks,

    Amruta

  • Hello,

    I am attaching simple project that write/read/erase 93LC46B Serial EEPROM (erase all but write and read single address).

    The project is for TMS570LS1224  LaunchPad but can be used as reference for setting SPI module.

    MIBSPI3 nCS0 is used to read button from LaunchPad ( if ( gioGetBit(mibspiPORT3, 0) == 0) ).

    As i don't have the same EEPROM as yours and that is why I have connected 93LC46B serial EEPROM.

    CS for 93LC46B is active high. Format of the instructions is different but this is not related with receiving data.

    1738.SPI_EPROM_1224PGE.ZIP

    Best regards,

    Miro

  • Hello,

    Since there is no feedback from you I'll close this thread. You can always write again to reopen it or you can open new thread,

    Best regards,
    Miro