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.

TMS320F28035: GPIO SET/ CLEAR

Expert 1190 points

Part Number: TMS320F28035

Hi,  I'm having a problem toggling GPIO0 reliably  using either of the following:

GpioDataRegs.GPASET.bit.GPIO0 = 1 / GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; 

or

          GpioDataRegs.GPATOGGLE.bit.GPIO0 = 1;

the config:

GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPADIR.bit.GPIO0 = 1;       
GpioDataRegs.GPACLEAR.bit.GPIO0 = 1;   

Is the Pin configured correctly?

2. what  value is assigned to X, to change the state of GPIO0

         GpioDataRegs.GPASET.all = X.

         is X declared a long or int?

         3.the Pin mux  tool output code to configure the GPIO. When the code is pasted into my source, the port pins are

             not configure correctly.  the device selected is correct and  no errors generated, not sure why?

        

         

           

      

  

  • JW,

    it looks like you have this configured mostly correct, what do you mean by "Reliably toggling"? Does it toggle sometimes? Does it start toggling then stop? Note that you can see some weird issues if you put read-modify-write instructions too close together.

    Check this wiki:  

    1. The mux selection is "GPIO" and the pin is configured as a output, if that is what you intended then yes it is correct.
    2. Simply writing a literal value will work, for example 0x5A5A. If you would like to use a variable both a Long or an Integer should work, but I would recommend using an integer because it's smaller in memory.
    3. I'm not a Pinmux tool expert, but...
      1. What GPIO configuration did you input?
      2. And what was incorrect about the output?

    Regards,
    Cody 

  • Hi Cody,
    1. ok
    2. ok
    3. I used the pin mux tool to define 10 gpio and CAN, does the generated code define the port pin usage?
    (Doing so condenses the port init source code)


    with stripped down code and toggles commands, all the designated GPIO change state.
    Substituting with set/clear for GPIO0, it's behavior is intermittent (maybe related surrounding code ??)
    If set/clear is substituted with other GPIOX, I don't see a problem. Suggesting a configuration issue with the GPIO0 or how it's controlled. When it does not work, its output appears at lower amplitude ~.5v
  • JW, 

    that is very weird that you are not seeing the issue consistently across different GPIOs, there is nothing special about the way you have configured GPIO0. Depending on how complex your code is maybe you are modifying the GPIO0 configuration during run time? You could try monitoring it using a hardware watchpoint or the memory browser.

    Even though it would be consistant across GPIOs I would recommend you take a look at the following wiki and see if you have the back-to-back write issue.

     

    Regards,
    Cody 

  • JW,
    I am going to close this thread due to inactivity. If it is not closed please feel free to respond here, or start a new thread if it has locked.


    Regards,
    Cody