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.

TMS570LS3137-EP: Using SPI as a GIO for external WatchDog

Part Number: TMS570LS3137-EP
Other Parts Discussed in Thread: HALCOGEN

I am trying to use the SPI2NCS[0] pin as a GIO to pet an external WatchDog (toggle every 1.6s else reset).

In my HALCOGEN I have enabled the SPI2 driver and for the SPI2 Port SCS[0] i have set the pin mode to GIO.

    /** - SPI2 Port output values */
    spiREG2->PC3 =    (uint32_t)((uint32_t)1U << 0U)  /* SCS[0] */
                                      | (uint32_t)((uint32_t)0U << 1U)  /* SCS[1] */
                                      | (uint32_t)((uint32_t)0U << 8U)  /* ENA */
                                      | (uint32_t)((uint32_t)0U << 9U)  /* CLK */
                                      | (uint32_t)((uint32_t)0U << 10U)  /* SIMO */
                                      | (uint32_t)((uint32_t)0U << 11U); /* SOMI */

I do not need to use the HALCOGEN functions to send the data because the code is interrupt context.

From the datasheet it is not clear to me how to use it as a GIO and simply toggle the ping.

  • Hi Aaron,

      I suppose in HalcoGen you have already configured the SPI2 SCS[0] as a GIO. If you did, you would have seen the below generated code for the PC0 register configuration. Writing a '0' to the PC0 at bit0 will make SCS[0] a GIO pin. 

      Once you do the above and also enable the GIO driver in HalcoGen you can use the gioSetBit() API to set/clear the SCS[0] pin in GIO mode.

      Let's say you want to set the SCS[0] pin high you will do something like below.

    gioSetBit(spiPORT2, 0, 1);

      If you want to clear the pin you will do:

    gioSetBit(spiPORT2, 0, 0);

      if you want to toggle SCS[0] you can also do:

    gioToggleBit(spiPORT2, 0);

    See below API for detail.

  • Thank you! This resolves my issue.