3 Replies Latest reply on Jun 21, 2018 10:19 AM by FrZa_2625781

    PortA Output not working




      I tried to activate GPIO pins on PortA but to no avail.

      My minimalistic firmware is this:


      IFCONFIG = 0x03;


      REVCTL = 0x03;


      EP6CFG = 0xE0;


      FIFORESET = 0x80;


      FIFORESET = 0x86;


      FIFORESET = 0x00;


      EP6FIFOCFG = 0x0C;


      PINFLAGSAB = 0x00;


      while (1) {}


      Now I want to activate PA1 and PA3 as GPIO outputs and inserted this before the while (1) {}:



      CLR IOA.1


      CLR IOA.3


      I know, syncdelay is not really required here, but it should not do any harm.


      The PA1 and PA3 pins are pulled to VCC by 22kOhm resistors and they stay high despite the GPIO pins being enabled as outputs (0x0A to OEA at SFR 0xB2) and cleared by the CLR commands.

      Even if I write 0x00 to 0xB0, which should also set the output pins low, they stay at 3.3V.


      What am I doing wrong?

        • 1. Re: PortA Output not working

          Hello Frank,


          Kindly, set the IOA register with the desired values to be output on the pins.

          The SFR address for IOA register is 0x80 and not 0xB0. Please refer to the EZUSB(R) Technical Reference Manual.



          Best regards,

          Srinath S

          • 2. Re: PortA Output not working

            Hi Srinath,


            sorry, the 0xB0 was my bad, but it was a typo only in the post here. In the firmware I already had 0x80 but with no effect.


            Also the problem seems to be to get the pin to work as an output.

            No matter what I do it stays in high-Z.


            I have now connected an LED to VCC via a 10k resistor and an LED to GND via a 10k resistor.

            So if the pin is high-Z like with input pins, both LEDs are lit up just a bit, because no current flows into or out of the pin.

            If I apply 0v or 3.3v to the pin externally via a 1k resistor one of the LEDs goes dark and the other one is lit up more, just as expected when the pin is at 0v or 3.3v.

            This way I can easily see if the pin is 0, 1 or high-Z.


            As I said before, the pin is always high-Z, no matter what I do.


            I checked especially with PA3, because PA3 output enable is not overridden by any alternate function like some other PortA pins, but even on PA3 I only get high-Z.


            The data transfer over the EP6 works like a charm and it ceases to work if I configure EP6 as an Out-Endpoint, so I am sure that the first part of the firmware is executed and then the OEA=0A should get executed, too.


            Can anything else prevent the PortA GPIOs from being outputs?

            • 3. Re: PortA Output not working

              Ok, for whatever reason OEA=0x0a had been translated to indirect addressing, which does not work with the SFR.


              I changed it manually to direct addressing and it is working now.