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.

TMS320F28P550SJ: TMS320F28P550SJ: Cannot change GPIO state in debug mode.

Part Number: TMS320F28P550SJ
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I am using TMS320F28P550SJ9 (64 PIN) microcontroller. It is unable to change the configuration state of GPIO28 and GPIO29 pins on theTMS320F28P550SJ even the GPyAMSEL register is used to configure these pins for digital operation. Physically, at controller pin gpio28/29 the value is changing but it do not reflecting the changes when viewed in the CCS register window during a debug session.

  • EALLOW/EDIS: I have wrapped my configuration code in EALLOW; and EDIS; instructions.
  • Pin Muxing: Set the GPIO mode using the GPxMUX, GPxGMUX registers.
  • Direction: Set the GPDIR as input.
  • GPyAMSEL : Set the GPyAMSEL register is used to configure these pins for digital (GPIO) operation.
  • Register View: I have refreshed the Register window in CCS, but no changes are observed.

EALLOW;
 //--------------------------------------------------------------------------------------
    GpioCtrlRegs.GPAAMSEL.bit.GPIO28 = 0;         // CONFIGURED AS GPIO
    GpioCtrlRegs.GPAGMUX2.bit.GPIO28  = 0;           // GPIO-28  
    GpioCtrlRegs.GPAMUX2.bit.GPIO28   = 0;           //
    GpioCtrlRegs.GPADIR.bit.GPIO28    = 0;           // 0-INPUT, 1-OUTPUT

    //--------------------------------------------------------------------------------------

    GpioCtrlRegs.GPAGMUX2.bit.GPIO29  = 0;           // GPIO-29  
    GpioCtrlRegs.GPAMUX2.bit.GPIO29   = 0;           //
    GpioCtrlRegs.GPADIR.bit.GPIO29    = 0;           // 0-INPUT, 1-OUTPUT

    //--------------------------------------------------------------------------------------
EDIS;

what is the issue? the configuration for other gpio pins it is working fine.

 

Thanks & Regards,

J. Rani

 

  • Hi,

    Is there any update on the above issue?

    Thanks & Regards,

    J. Rani

  • Hi Rani,

    A couple of different things are getting mixed together here.

    Regardiing "can’t “force” a GPIO by editing GPxDAT", on C2000, the GPxDAT bits reflect the actual pad state at the pin. They are not meant to be written to in order to drive the pin. To change an output state you must configure the pin as output (GPADIR = 1) and write to GPxSET / GPxCLEAR / GPxTOGGLE. You can’t change it from CCS unless you physically change what drives it.

    In the code you shared, you explicitly do:

    GpioCtrlRegs.GPAAMSEL.bit.GPIO28 = 0;

    but you never clear GPAAMSEL.bit.GPIO29. If GPIO29 is still in analog mode, you may see “odd” behavior when expecting normal digital GPIO behavior / readback.

    So add:

    EALLOW;
    GpioCtrlRegs.GPAAMSEL.bit.GPIO28 = 0;
    GpioCtrlRegs.GPAAMSEL.bit.GPIO29 = 0;
    EDIS;

    On the LaunchPad, GPIO28 (SCIA_RX) and GPIO29 (SCIA_TX) are routed to the on-board XDS110 virtual COM port by default, and routing is controlled by the on-board switch S2. That can absolutely confuse “GPIO behavior” expectations while debugging.

    Best Regards,

    Masoud

  • Hi Masoud,

    > but you never clear GPAAMSEL.bit.GPIO29. If GPIO29 is still in analog mode, you may see “odd” behavior when expecting normal digital GPIO behavior / readback.

    The GPIO29 Pin does not have alternate functionality it is defined as GPIO so, I did not write GpioCtrlRegs.GPAAMSEL.bit.GPIO29 = 0;

    It is custom PCB in hardware the GPIO28/29 Pins having voltage 3.2v. But in in GPIO configuration register (in debugging) it is showing 0 state. even when pin state change in the hardware also it is not changing.

    I did same thing for another GPIO'S (GPIO11, GPIO33) for these it is working fine. in hardware when I change pin state, the same thing is reflecting at GPIO Configuration register.

  • Hi Rani,

    I have two questions:

    Are you calling Board_init() / SysConfig init anywhere (and where)?

    Are you reading GPADAT or a “GPIO status” view in CCS?

    We have separate register groups for GPIO_DATA_REGS to the output data latch (what you last wrote) and GPIO_DATA_READ_REGS to the actual pin state (what the pad is seeing). So if GPIO29 is configured as an input, the output latch will NOT follow your external 3.2 V level, it will stay whatever it was last written (often 0), which looks like it doesn’t change in debug.

    It would be helpful if you share a screenshot of the following in CCS (for GPIO29): GPAMUX/GPAGMUX, GPADIR, and the value you’re viewing (DATA vs DATA_READ).

    Best Regards,

    Masoud