K20 GPIO Input remains High

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

K20 GPIO Input remains High

跳至解决方案
1,654 次查看
chris321
Contributor IV

Hello Cmmunity,

I've configured a K20 GPIO pin (PTC4) as an input pin with the Kinetis Design Studio Driver BitIO.

Now it is possible to detect lows and highs on this pin. But after the High applied to this pin and left floating again the pin is on ~3V. The internal pull ups and downs are disabled.

Is this a normal behavior or can this near-high-level on a input pin after an attached high lvl be bypassed (without a pull down)?

标签 (1)
0 项奖励
回复
1 解答
1,312 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi chris321,

  You test result is the same with me, this is the nomal behavior.

  If you want the input data is low, you can enable internal pull down register.

  Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

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

在原帖中查看解决方案

0 项奖励
回复
7 回复数
1,312 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi chris321,

    Could you tell me the full partnumber of your chip?

    I test the PTC4 input voltage level on my K20D50m board with disabled internal pullups and downs.

  After the high voltage input, then left the pin floating, the input data will be low voltage.

1: input high voltage

pastedImage_0.png

2: Floating PTC4

I think, you can check your register, whether you really disable the pullup and downs.

But if you want to have a clear level after floating your pin, you should better enable the internal pull down resistor.

Wish it helps you!


Have a great day,
Jingjing

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

0 项奖励
回复
1,312 次查看
carlostadeoorte
Contributor III

Hello,

I know this answer has been tagged as resolved, however, I am not too happy with it.  I have similar problem using the KL03 microcontroller.  I would like a pin to discharge after a logic "1" is strobed. I use the HAL API on bare metal (no PE nor drivers).

This is a pseudocode of what my code looks like:

1) Enable clocks to ports (A,B)

2) Set Port A5 to output  Port B1 as input and connect them physically using a cable on the dev board

3) Enable a High-to-low interrupt on B1

4) Connect A5 to B1 and strobe a "1" on A5

5) Change A5 to "Pin Disabled"

6) Wait for interrupt --- nothing happens until I connect a multimeter on A5/B1 -- Then it interrupts

I have tried similar steps:

1,2,3,4,6 remain the same. Instead of 5, I have driven A5 to low. Then B1 calls the ISR.

Is there anything on the reference manual (for either the K20 or the KL03) that I can check why this behavior is normal? I _need_ to understand why this is happening, because this behavior is important in my application.

Do any of you know if  this will also happen if I use the port as as a trigger on the LPWUC?

Any help will be great!

Best,

-Carlos

0 项奖励
回复
1,312 次查看
carlostadeoorte
Contributor III

Hey,

Just to answer my own question. PB1 on the FRDM-KL03z board is connected to the OpenSDA environment, which has inerternal pups/pdowns.  I connected instead to PB0. Removed the R37 and the pin works as it should be.

Thanks again,

-Carlos

0 项奖励
回复
1,312 次查看
chris321
Contributor IV

Hi Jingjing,

I am using the MK20DX256VLK10.

Here the register values from the GPIOC_PDIR for the 3 stages:

1. floating input/ or pulled to GND : 0x0

2. pulled up (via 10k) : 0x10

3. left floating again: 0x10

0 项奖励
回复
1,313 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi chris321,

  You test result is the same with me, this is the nomal behavior.

  If you want the input data is low, you can enable internal pull down register.

  Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

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

0 项奖励
回复
1,312 次查看
chris321
Contributor IV

Hi Jingjing,

I have to measure the time untill a (really small) capacitor on this pin is discharged, after it were previously charged with the same pin.

I suppose that with the pull down the cap would be discharged too fast.


So far I were not able to discover such a behavior on any other microcontroller. Is this K20 specific or is this only a unfavorable behavior of this pin?

0 项奖励
回复
1,312 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi chris321,

    Actually, when the input digital pin is floating, the input data is not stable(not always high), it is determined by the external circuit, and maybe disturbed by the noise.

    I think you should use the analog pin instead of the digital pin and keep the input voltage inside of the ADC input voltage range , because digital is just have the high and low level, and input uncertain data when it is floating.

Regards,

Jingjing

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复