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.

Reading from GPIO pin in TMS320F28335

Other Parts Discussed in Thread: TMS320F28335, TMDSCNCD28335

Hi

I am using TMS320F28335 controlCARD with TMDSCNCD28335 release 2.2. I am unable to read from GPIO0 pin when it is configured as output. Also i wish to use the GPIO0 pin information inside the ADC interrupt. Kindly help. Thanks in advance.

  • Perhaps you have done this already, but please take a look at Chapter 6 of the TMS320x2833x, 2823x System Control and Interrupts Reference Guide for information about the GPIO configuration of pins.  This should be a useful resource as you debug why you are unable to read the value on the pin of GPIO0.

    Figure 40 of the above document is a good way to picture how the configuration registers control the connections of peripheral modules and GPIO data registers to the actual pins of the device.

    It may also be helpful if you share how you have the GPIO configuration registers set.

    You mention you are unable to read from the GPIO0 pin when it is configured as an output.  Would you be able to describe the observed behavior in more detail?

    Do you have anything connected externally to GPIO0 that may have some influence on the results you are getting?

  • Hii..

    I am configuring gpio0 as under:

     EALLOW;

     GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; 

     GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1;

     GpioCtrlRegs.GPADIR.bit.GPIO0= 0x0001;

    EDIS;

    and after defining a variable (say a) i am writing the following statement inside ADC interrupt:

    a  =  GpioDataRegs.GPADAT.bit.GPIO0;

    .

    .

    after doing this when i am looking in the watch variables window, 'a' is not following GpioDataRegs.GPADAT.bit.GPIO0.

  • Hello,

    May I know what kit you are using for this controlCard and what example project that you use?

    GPIO0 is mux with EPWM-1A and usually EPWM-1A is used for another purpose (especially for Motor example project).

    Please make sure that this GPIO0 is not used for another purpose (check your schematic also).

    Best regards,

    Maria

  • I wouldn't expect your variable 'a' to track the GPIO data register GPADAT.bit.GPIO0.  This is due to the following line in your code which modifies the multiplex option of what drives the pin to be the peripheral rather than the GPADAT register.

    GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1;

    If you consult the TMS320x2802x/TMS320F2802xx Piccolo System Control and Interrupts Reference Guide in Chapter 4, Table 60 indicates that setting the GPAMUX1.bit.GPIO0=01b, configures this pin to propagate EPWM1A rather than the GPIO0.  You need to configure GPAMUX1.bit.GPIO0=00b instead.  Then you should be able to see variable 'a' track the GPADAT.bit.GPIO0.

  • How to set GPIO41_XA1 , XA0 in program, since i am not able to set and clear these Address XA0 to XA19
  • Arun,

    Can you provide some more detail about the issue? In which mode you are using these pins?

    Regards,

    Vivek Singh