µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: eduardovra on April 11, 2008, 07:48:46 PM
-
Hi All !
I'm working in a custom board that uses MCF52233 and I'm having trouble to use PORTTA as GPIO input pin.
Look to my code so you could give your opinion:
PTAPAR = 0x00; // First I configure the port for GPIO Mode
DDRTA &= 0x00; // Then I set the direction as input
MyVar = PORTIN_SETTA; // So I try to read the pin state
Although it's disconnected electrically, the voltimeter always shows 0 volts in the pins, so I always read 0 from the port's register.
When I connect the 3.3 V supply directly to pins of the port, I can read high logic state from my code. I conclude there's a problem with the processor's pull-up resistors.
I've read the Processor's Reference Manual from Freescale and it says that all pins that are configured as GPIO have default enabled pull-up resistors internally, but it seems don't have.
Any tips ?
Best Regards
Eduardo
-
Hi Eduardo
In my experience the GPT port operates as stated in the user manual - out of reset it is an input with active pull up resistor.
I have just verified this on a M52233DEMO board as follows:
- 1. Connect to the board using debugger and stop before program execution.
- 2. Measure the voltage on the input pins (I measured GPT3 and GPT2, where it was necessary to remove R49 so that it was not pulled down by a connection to the accelerometer chip on the board.
- here I measures 3.3V on each pin - 3. Look at the register view in the debugger (CodeWarrior) and see when content of SETTA displays - here it was showing also '1' on each of these inputs.
- 4. Using a 10k resistor, connect the input pin to 0V and measuer the voltage drop. This was showing a drop to about 0.4V, indicating a weak pull up resistor of about 100K equivalent.
These results are therefore consistent with the presence of the pull-up device, which can not be disabled.
Note that the electrical specification doesn't state an equivalent resistor value but rather a current. This current can vary quite widely so I interpret this as meaning that the actual pull up value (which is weak) can vary between around 30K and 300K. [In a project with M5213 I noted all GPIOs as having approx. equivalent 30k pull-ups on all GPIOs].
Is it possible that you have something connected to the pin on your board which is taking current from the input? When measuring a weak current source be careful that the measuring equipment is not loading it (eg. an analogue multimeter could have a relatively low impedence and so pull the input value down when connected).
As summary, I don't think that the M52233 has an error so I think that you need to carefully re-check your measurements. The code looks fine, but the default state out of reset is in fact the same.
Good luck
Regards
Mark