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.

[FAQ] TMS570LC4357: How to use different peripherals pins (like Lin, MibSPI, N2HET, ECLK and RTP) as GIO

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

How to use different peripherals pins as GIO, like

1. MibSPI pins as GIO

2. Lin pins as GIO

3. N2HET pins as GIO

4. ECLK pin as GIO

5. RTP pins as GIO

  • 1. MibSPI pins as GIO

    i) First configure the pin functionality to GIO in HALCoGen

    ii) Also configure the pin direction as either input or output depending on the requirement

    In this example i am configuring the pin functionality as GIO and pin direction as output for all the pins.

    iii) Also enable MibSPI functionality for required pins in Pin Muxing table.

    here i am enabling MibSPI3 functionality for required pins in Pin Muxing table.

    iv) Now in driver enable tab, enable the GIO and MibSPI drivers. After enabling these drivers now generate the HALCoGen code.

    v) If the pin is configured as GIO output then use the "gioSetBit" function to SET and CLEAR the pin state.

    In above example code i used bit-9 (second argument in the gioSetBit function) for MIBSPI3CLK, bit-10 for MIBSPI3SIMO and bit-11 for MIBSPI3SOMI etc, all these information is available in TRM at PC registers section.

    vi) If the pin is configured as GIO input then use gioGetBit function to get the current value of the pin. This function also requires bit value as second argument and it is same as the value used for gioSetBit function.And this function will return the pin value.

    I am attaching example project for the reference

    7144.MIBSPI3_AS_GIO_LC4357.zip

  • 2. Lin pins as GIO

    i) First configure the pin functionality to GIO in HALCoGen

    ii) Also configure the pin direction as either input or output depending on the requirement.

    In this example i am configuring the pin functionality as GIO and pin direction as output for all the pins.

    iii) Also enable Lin functionality for required pins in Pin Muxing

    In this case it is not required as the pins have already default Lin functionality.

    iv) Now in driver enable tab, enable the GIO and LIN drivers. After enabling these drivers now generate the HALCoGen code.

    v) If the pin is configured as GIO output then use the "gioSetBit" function to SET and CLEAR the pin state.

    In above example i used bit-1 (second argument in the gioSetBit function) for LIN_RX and bit-2 for LIN_TX, all this information is disclosed in the PIO register sections of TRM.

    vi) If the pin is configured as GIO input then use gioGetBit function to get the current value of the pin. This function also requires bit value as second argument and it is same as the value used for gioSetBit function.And this function will return the pin value.

    I am attaching example project for the reference.

    5531.LIN_AS_GIO_RM46.zip

  • 3. N2HET pins as GIO

    i) Configure the pin direction as either input or output depending on the requirement

    Here i am configuring N2HET1 pin30 as GIO output with Pull-down.

    ii) Also enable N2HET functionality for required pins in Pin Muxing

    In this case it is not required as the pins have already default N2HET functionality.

    Default functionality for B11 pin is N2HET[30], so no need to enable it.

    iii) Now in driver enable tab, enable the GIO and N2HET1 drivers. After enabling these drivers now generate the HALCoGen code.

    iv) If the pin is configured as GIO output then use the "gioSetBit" function to SET and CLEAR the pin state.

    In above example i used bit-30 (second argument in the gioSetBit function) for N2HET1[30], all this information is disclosed in the HETDOUT register sections of TRM.

    v) If the pin is configured as GIO input then use gioGetBit function to get the current value of the pin. This function also requires bit value as second argument and it is same as the value used for gioSetBit function.And this function will return the pin value.

    I am attaching example project for the reference.

    0763.N2HET_AS_GPIO_LC4357.zip

  • 4. ECLK pin as GIO

    i) First configure the pin functionality to GIO in HALCoGen

    ii) Also configure the pin direction as either input or output depending on the requirement.

    In this example i am configuring the pin functionality as GIO and pin direction as output.

    iii) Also enable ECLK functionality for required pin in Pin Muxing

    In this case it is not required as the pins have already default ECLK functionality.

    iv) Now in driver enable tab, enable the GIO driver. After enabling this driver now generate the HALCoGen code.

    v) If the pin is configured as GIO output then use the "gioSetBit" function to SET and CLEAR the pin state.

    vi) If the pin is configured as GIO input then use gioGetBit function to get the current value of the pin. This function also requires bit value as second argument and it is same as the value used for gioSetBit function.And this function will return the pin value.

    I am attaching example project for the reference.

    6114.ECLK_AS_GIO_OUTPUT_RM46.zip