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.

TMS570LS1224: How to use SPI4 pins as GPIO?

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Dear all,

the hardware used for this issue is TI Launchpad XL2-TMS57012, 144pin PGE version.
Below code was used to test to toggle SPI4ncs_0 when set as gpio. Code reference from thread "How to us HET pins as GPIO?".

The signal output of the pin from SPI4ncs_0 did not toggle although it worked when SPI4ncs_0 is set as SPI4ncs_0.

1)How to set SPI4 port as GPIOs? when SPI4ncs_0 set to GIO in Halcogen SPI4 port block setting, the generated pinmux.c for pin 24 SPI4nCS_0 is set to HET1_03.
"pinMuxReg->PINMMR4 = PINMUX_PIN_22_GIOA_7 | PINMUX_PIN_23_HET1_01 | PINMUX_PIN_24_HET1_03;"

in pinmux.h
#define PINMUX_PIN_24_HET1_03 ((uint32)((uint32)0x1U << PINMUX_PIN_24_SHIFT))
#define PINMUX_PIN_24_SPI4NCS_0 ((uint32)((uint32)0x2U << PINMUX_PIN_24_SHIFT))
#define PINMUX_PIN_24_HET2_10 ((uint32)((uint32)0x10U << PINMUX_PIN_24_SHIFT))
#define PINMUX_PIN_24_EQEP2B ((uint32)((uint32)0x20U << PINMUX_PIN_24_SHIFT))

Which of these #define ports setting of SPI4ncs_0 pin is consider to be the GPIO mode as mentioned in TI datasheet Table 4-11??


2)Is there any difference between MibSPI1 and SPI4 port to be used as GPIOs?
as the pinmux.c for pin 105 will set to PINMUX_PIN_105_MIBSPI1NCS_0 when select as GIO in Halcogen.

void Spi_gpio_toggle()

{

spiREG4->GCR0 = 0U;
spiREG4->GCR0 = 1U;

gioSetDirection(spiPORT4,(1<<SPI_PIN_CS0));
gioSetBit(spiPORT4, SPI_PIN_CS0, 1);

while(1)
{
//spiPORT4->DSET= 0x01;
gioSetBit(spiPORT4, SPI_PIN_CS0, 1);

//manually wait with breakpoint to toggle
//spiPORT4->DCLR = 0x01;
gioSetBit(spiPORT4, SPI_PIN_CS0, 0);
}
}


thank you,
benjamin

  • Hello Ben,

    Please Use SPIPC0 to configure CS0 as GIO. You can configure CS0 as GIO through HALCoGen:

    Under PINMUX, the CS0 pin is still configured as SPI.

    There is no difference for using MibSPI and SPI as GIO.

  • Dear QJ,

    thanks for the reply.

    Previously it's not working because the connection of SPI4ncs_0 in PINMUX was not set, was left as unconnected.
    Have retried and it can work. If the pinmux in Halcogen for pin24 is not set, it cannot work.

    this is quite confusing having to set the pinmux as a SPI4ncs_0 function to use it as gpio.

    thanks,
    benjamin