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/TMS570LS1224: Using MIBSPI3 pins as GIO

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Good morning gents,

I've been stuck on this one for a few days and I'd be grateful for any tips.

In my application, I want to use MIBSPI3CLK, MIBSPI3SOMI and MIBSPI3SIMO as a GIO pin. I will not be using any of the MIBSPI3 pins for SPI purposes. 

In Halcogen I have enabled the SPI3 Driver:

and in SPI3 I have selected the following:

I have left MIBSPI3 as it was.

In CCS I have included spi.h in my sys_main.c and I have added the following lines

  /*Bring SPI out of reset.*/
      spiREG3->GCR0 = 1U;       // we don't want the full functionality of SPI, hence why we don't call spiInit()

      gioSetDirection(spiPORT3, 0x000000FF);

And within my while(1) I have

    gioToggleBit(spiPORT3,9);  // CLK
    gioToggleBit(spiPORT3,10); // SIMO
    gioToggleBit(spiPORT3,11); // SOMI

However, this does not work. I am toggling other GIO ports successfully, so I suspect there is something dodgy about the way I have configured SPI3. Any guidance/advice would be greatly appreciated.

Regards,

Sofia

  • Hello Sofia,

    All of the SPI pins may be programmed via the SPIPCx control registers to be either functional (SPI) or GIO pins. If you want to use SPI_CLK, SPI_SIMO, and SPI_SOMI as GIO pins, please configure the SPIPC0 correctly before using those pins.

    /* SPI3 set CS/CLK/SIMO/SOMI pins to GIO */
    spiREG3->PC0 = (uint32)((uint32)0U << 0U) /* SCS[0] */
    | (uint32)((uint32)0U << 8U) /* ENA */
    | (uint32)((uint32)0U << 9U) /* CLK */
    | (uint32)((uint32)0U << 10U) /* SIMO */
    | (uint32)((uint32)0U << 11U); /* SOMI */
  • Hi QJ,

    Thanks for responding, but I am afraid that is already done by Halcogen and it's not working.

    In spi.c I have:

     /* SPI3 set all pins to functional */
        spiREG3->PC0  =   (uint32)((uint32)0U << 0U)  /* SCS[0] */
                        | (uint32)((uint32)0U << 1U)  /* SCS[1] */
                        | (uint32)((uint32)0U << 2U)  /* SCS[2] */
                        | (uint32)((uint32)0U << 3U)  /* SCS[3] */
                        | (uint32)((uint32)0U << 4U)  /* SCS[4] */
                        | (uint32)((uint32)0U << 5U)  /* SCS[5] */
                        | (uint32)((uint32)0U << 8U)  /* ENA */
                        | (uint32)((uint32)0U << 9U)  /* CLK */
                        | (uint32)((uint32)0U << 10U)  /* SIMO */
                        | (uint32)((uint32)0U << 11U); /* SOMI */

  • Hi Sofia,

    Yes, the code is placed in spiInit(), but you didn't call spiInit() in your main().