cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

FrZa_2625781
New Contributor II

Hi,

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

My minimalistic firmware is this:

IFCONFIG = 0x03;

SYNCDELAY;

REVCTL = 0x03;

SYNCDELAY;

EP6CFG = 0xE0;

SYNCDELAY;

FIFORESET = 0x80;

SYNCDELAY;

FIFORESET = 0x86;

SYNCDELAY;

FIFORESET = 0x00;

SYNCDELAY;

EP6FIFOCFG = 0x0C;

SYNCDELAY;

PINFLAGSAB = 0x00;

SYNCDELAY;

while (1) {}

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

OEA=0x0A;

SYNCDELAY;

CLR IOA.1

SYNCDELAY;

CLR IOA.3

SYNCDELAY;

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?

0 Likes
Reply
1 Solution
FrZa_2625781
New Contributor II

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.

View solution in original post

0 Likes
Reply
3 Replies
SrinathS_16
Moderator
Moderator

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.

http://www.cypress.com/file/126446/download

Best regards,

Srinath S

0 Likes
Reply
FrZa_2625781
New Contributor II

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?

0 Likes
Reply
FrZa_2625781
New Contributor II

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.

View solution in original post

0 Likes
Reply