K40: open drain not working

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

K40: open drain not working

2,568 次查看
MBC
Contributor II

I created a project using PE. GPIO outputs are initialized in an open-drain mode. When the output applied to the logic "1" output voltage is not more than 3.6 Volts. Outputs pulled up to 5V source voltage with 450 ohms resistor.
Status register PORTB_PCR19 after initialization:

 

PORTB_PCR19 = 120Pin Control Register nBit Field Values:      bits[ 31:25 ] = 0 ISF  bits[ 24:24 ] = 0 Configured interrupt has not been detected.      bits[ 23:20 ] = 0 IRQC bits[ 19:16 ] = 0 Interrupt/DMA Request disabled. LK   bits[ 15:15 ] = 0 Pin Control Register bits [15:0] are not locked.      bits[ 14:11 ] = 0 MUX  bits[ 10:8  ] = 1 Alternative 1 (GPIO).      bits[  7:7  ] = 0 DSE  bits[  6:6  ] = 0 Low drive strength is configured on the corresponding pin, if pin is configured as a digital output. ODE  bits[  5:5  ] = 1 Open Drain output is enabled on the corresponding pin, provided pin is configured as a digital output. PFE  bits[  4:4  ] = 0 Passive Input Filter is disabled on the corresponding pin.      bits[  3:3  ] = 0 SRE  bits[  2:2  ] = 0 Fast slew rate is configured on the corresponding pin, if pin is configured as a digital output. PE   bits[  1:1  ] = 0 Internal pull-up or pull-down resistor is not enabled on the corresponding pin. PS   bits[  0:0  ] = 0 Internal pull-down resistor is enabled on the corresponding pin, if the corresponding Port Pull Enable Register bit is set.

This is a hardware error? How to fix?


0 项奖励
回复
4 回复数

1,767 次查看
soli
Contributor I

Hello,

 

3 years later I have exactly the same problem (like the poste above)  when using the GPIO on K40.

 

Software:

=============

The pin is set to GPIO-mode, open drain is enabled and the pull-up/down is disabled.

 

Hardware:

=============

The pin is connected with serial resistor to 5V.

 

 

By setting the pin to output and set to low, I get 33 mV on this pin.

By setting the pin to output and set to high, I get 3,66 V on this pin.

 

So the Open Drain settings are not working. Is this a hardware bug?

 

Only when I set the GPIO to input I will get my desired 5V on this pin.

 

Does anyone can say how I could use the open drain mode?

0 项奖励
回复

1,767 次查看
mjbcswitzerland
Specialist V

Hi

 

I think that you shouldn't be using 5V with the 3.3V ports. This will cause the GPIO protection diode from the port pin to V3.3 to start conducting and so you will get a 'short-circuit' through the diode which will be measured as about 3.6V.

 

If you use 3.3V input (pull-up to this value) the open-drain function will probably be OK.

 

Regards

 

Mark

 

0 项奖励
回复

1,767 次查看
soli
Contributor I

Hi and thank you for replay,

 

on chapter “4.4 Voltage and current operating ratings” I can see that V_DIO (Digital input voltage) allow up to 5.5V (except RESET, EXTAL, and XTAL). I know 5V is not the best choose but should be ok for this devise.

 

So the problem with not working open drain will stay tune.

 

0 项奖励
回复

1,767 次查看
MarkP_
Contributor V

Hi,

K40 Errata says:

e2545: GPIO: PTB[0:11], PTB[16:23], PTC[0:19], and PTD[0:7] are not 5 V tolerant

Workaround: Limit the external voltage on these pins to VDD.

 

http://cache.freescale.com/files/microcontrollers/doc/errata/KINETIS_0M33Z.pdf?fpsp=1&WT_TYPE=Errata...

 

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K40_100&tab=Documentation_Tab&pspll=1... Sheets&fpsp=1&linkline=Data Sheets

 

~Mark

 

 

0 项奖励
回复