PTA2/PTA3 as GPIO Output on KE02

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PTA2/PTA3 as GPIO Output on KE02

Jump to solution
1,799 Views
justusandjustic
Contributor III

I am using the S9KEAZN64 chip, and am trying to use PTA3 as an output GPIO.  When I test the chip on a lone breakout board, setting the pin as an output GPIO, with initial value of 1, I am not reading any output voltage.  Using the same configuration on adjacent pins, both PTA2/PTA3 show no output voltage, while other pins work fine.  The documentation states that:

"All functional non-supply pins, except for PTA2 and PTA3, are internally clamped to VSS and VDD. PTA2 and PTA3 are true open drain I/O pins that are internally clamped to VSS."

I'm not entirely certain what that means, but clearly these pins are different in some way.  I attempted to enable the pull-up resistor for the pins, with the same result: no voltage output.

What is the proper way to use these pins as GPIO outputs?  Are external pull-ups required? If so, why is it not mentioned in the manual?  Perhaps I just missed it?

Thanks,

 

-Josiah

Tags (1)
1 Solution
1,696 Views
mjbcswitzerland
Specialist V

Josiah

From the user's manual:

pastedImage_1.png

It states that on "normal" pins the pull-up is disconnected when the GPIO is used as an output (seen also form the diagram 11-1)
From my understanding of the true open drain types (according to figure 11-2) the pull-up 'should' be connected also when used as an output as long as the output is driving to '1' (when the output drives to 0 the pull-up is disconnected).

When I test I find, however, that the PTA2/3 GPIO behave as open-drain but with the normal control (that is, when configured as output the pull-up is disconnected. This doesn't correspond with the diagram.
The additional detail about them retaining their pull-up setting in I2C peripheral mode is a different question and no equivalent diagram is given for that.

Even though this detail about the pull-ups not being usable when configured as GPIO output (which may be an error either in the GPIO design or in the user's manual diagram) it is not a big issue from the point of view of the firmware. To use the pins as GPIO one can do the following:

1. Configure the pull-up and pin as output, driving 0 - this gives a low impedance '0' at the output.
2. Configure the pin as input, which gives a '1' output (through pull-up)
Each time the pin state needs to be changed switch to either output to drive '0' or switch back to input to 'drive' '1'

Therefore, it can still be used functionally as open-drian output with pull-up, without needing to add an external resistor. Just the firmware control of these 2 pins needs to be slightly different.

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

View solution in original post

7 Replies
1,694 Views
nxf56274
NXP Employee
NXP Employee

Hi,

PTA2/PTA3 is a true open-drain pin when operated as output. It means when you control it to output low level, it output low level. If you want it to output high level, it will show high resistance state. So if you want it to output high level, you need external pullup.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,696 Views
justusandjustic
Contributor III

Thanks for confirming!  That was my suspicion, but as a software person (not really a hardware person), that was not immediately obvious.  Why was this crucial requirement not explicitly stated in the manual?  Or did I just miss it?

-Josiah

0 Kudos
Reply
1,696 Views
nxf56274
NXP Employee
NXP Employee

Hi,

As a MCU engineer, we should learn both software and hardware. The software has strong link with hardware. 

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,696 Views
justusandjustic
Contributor III

I absolutely agree.  Which is why that information would have been great to have been in the manual, so I could have learned it...

In fact, as Mark mentioned, the manual seems to be incongruent with reality.

0 Kudos
Reply
1,697 Views
mjbcswitzerland
Specialist V

Josiah

From the user's manual:

pastedImage_1.png

It states that on "normal" pins the pull-up is disconnected when the GPIO is used as an output (seen also form the diagram 11-1)
From my understanding of the true open drain types (according to figure 11-2) the pull-up 'should' be connected also when used as an output as long as the output is driving to '1' (when the output drives to 0 the pull-up is disconnected).

When I test I find, however, that the PTA2/3 GPIO behave as open-drain but with the normal control (that is, when configured as output the pull-up is disconnected. This doesn't correspond with the diagram.
The additional detail about them retaining their pull-up setting in I2C peripheral mode is a different question and no equivalent diagram is given for that.

Even though this detail about the pull-ups not being usable when configured as GPIO output (which may be an error either in the GPIO design or in the user's manual diagram) it is not a big issue from the point of view of the firmware. To use the pins as GPIO one can do the following:

1. Configure the pull-up and pin as output, driving 0 - this gives a low impedance '0' at the output.
2. Configure the pin as input, which gives a '1' output (through pull-up)
Each time the pin state needs to be changed switch to either output to drive '0' or switch back to input to 'drive' '1'

Therefore, it can still be used functionally as open-drian output with pull-up, without needing to add an external resistor. Just the firmware control of these 2 pins needs to be slightly different.

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

1,696 Views
justusandjustic
Contributor III

Mark,

Thank you for that information.  I was puzzled that the pull-up did not function while in output mode, and I'm glad you were able to confirm what I was seeing.  I also appreciate your suggested work-around.  I had considered that possible solution, but wasn't sure if that was the best way to go about it.

You have been extremely helpful. Thanks!

-Josiah

0 Kudos
Reply
1,696 Views
mjbcswitzerland
Specialist V

Hi Josiah

from the user's manual:

pastedImage_1.png

The pins do have programmable pull-ups (which are automatically disconnected when the output is driven low) so you may need to check that you are correctly activating them and also that you don't have too much load to ground that the pull-up resistor can't drive.

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

0 Kudos
Reply