KE02 GPIO Strange Behavior

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

KE02 GPIO Strange Behavior

679 Views
jorged_avila
Contributor II

Hello!

I'm fighting a strange behavior in what should be a very simple situation:

  • MCU MKE02Z16VLD2;
  • I need to use 2 pins (PTB1, PTB2) alternately as Input and Output;
  • When using them as Inputs, my external drive is very low current, so I rely on the MCU having a very low leakage current. Datasheet say this current is typically 0.1uA, max 1uA;
  • When testing the circuit, the external drive was not capable of driving the MCU pins. Further search showed the port leaking a much higher current - in the order of 100uA;
  • For a test circuit, I connected each pin to a pair of resistors, 33k, to GND and VDD, making in effect a load near 100uA when driven High or Low;

 I compiled and ran this test code:

for (;;)
   {
   FGPIO_PCOR_REG (portIO) = maskIO2 | maskIO3;       // IO LO
   FGPIO_PDDR_REG (portIO) |= (maskIO2 | maskIO3);    // IO Output  0.008
   FGPIO_PDDR_REG (portIO) &= ~(maskIO2 | maskIO3);   // IO Input   0.187
   FGPIO_PSOR_REG (portIO) = maskIO2 | maskIO3;       // IO HI
   FGPIO_PDDR_REG (portIO) |= (maskIO2 | maskIO3);    // IO Output  3.321
   FGPIO_PDDR_REG (portIO) &= ~(maskIO2 | maskIO3);   // IO Input   2.736
   }

Single stepping through this code, I measured, after each line execution, the voltages shown at the right:

  • After driving the pin Low and reverting it to Input, it remains at a very low voltage;
  • After driving the pin High and reverting it to Input, it remains at a very high voltage;
  • A short circuit to the opposite rail, by means of a current meter, show the current to be around 100uA, also.

I must say I'm stuck! No idea why this is happening. I would appreciate anyone pointing out where am I busting it!

Labels (1)
Tags (2)
0 Kudos
3 Replies

492 Views
mjbcswitzerland
Specialist V
0 Kudos

492 Views
jorged_avila
Contributor II

No results... :-(

Anyway I'd need the input function enabled.

Thanks!

0 Kudos

492 Views
mjbcswitzerland
Specialist V

Jorge

FGPIOx_PIDR defaults to 0xffffffff, which means that the pin is NOT configured as general purpose input. To use it as input you will need to set the bits to '0'. However, it doesn't look to have any effect on the high leakage that you presently have.
What happens when you hold the processor in RESET? All pins should then be in high impedance state during and immediately after reset - if you get high leakage it can only be the chip (or other circuitry).

Regards

Mark

0 Kudos