KE06 GPIO inputs

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

KE06 GPIO inputs

Jump to solution
1,929 Views
davidsherman
Senior Contributor I

I'm trying to understand something about reading the GPIO PDIR.  In the reference manual, it says:

The GPIO input data register displays the logic value on each pin when the pin is configured for any digital function,

provided the corresponding Port Control and Interrupt module for that pin is enabled.

Am I to understand that the KBI module has to have the pin interrupt enabled to read the state of the pin when it is configured as an input?  I was able to read back the input state once I enabled the input in the PIDR register.  I had been having some problems reading it, but I think it was the debugger being flaky and not reporting things correctly.  I was just looking for clarification on what it means by enabling the interrupt module.

1 Solution
908 Views
mjbcswitzerland
Specialist V

David

I believe that the details about "Port Control and Interrupt  Module" in the KE06 user's manual can be ignored because it looks to be text taken from the K-series devices which have a Port Configuration module (which then contains interrupt capabilities).

The KE devices don't have this module and the pin multiplexing is 'hard-wired' depending on enabled peripherals.

However there is a GPIOx_PIDR register which the K series doesn't have which needs to be configured before inputs are sampled. Each input is disabled by default (meaning that its value is not sampled and so the value in GPIOx_PDIR doesn't follow it) so clearing its bit in that register allows its state to be subsequently read.

Practically:

1. The ports don't need to be enabled (no peripheral clock needs to be enabled to them)

2. To be able to read the input state the bit in GPIOx_PIDR needs to be set to '0'

3. The present input state can then be read via GPIOx_PDIR

Regards

Mark

µTasker Kinetis support

View solution in original post

5 Replies
908 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi David,

The GPIO and KBI are separated modules. The GPIOx_PDIR register is used to read GPIO pin input status, which only used for GPIO pin as input pin.

And KBI is pin another function, which is different from GPIO function using KBI module related register and generated related interrupt.


Wish it helps.
best regards
Ma Hui

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

0 Kudos
910 Views
davidsherman
Senior Contributor I

Thanks, but did you read my question?  I know what the KBI and GPIO modules do.  The KE06 Reference Manual clearly says on page 677:

The GPIO input data register displays the logic value on each pin when the pin is configured for any digital function,

provided the corresponding Port Control and INTERRUPT MODULE FOR THAT PIN IS ENABLED.

So, what does it mean by enabling the interrupt module of that pin?  I do not want to cause an interrupt, I just want to read the state of the pin.

0 Kudos
909 Views
mjbcswitzerland
Specialist V

David

I believe that the details about "Port Control and Interrupt  Module" in the KE06 user's manual can be ignored because it looks to be text taken from the K-series devices which have a Port Configuration module (which then contains interrupt capabilities).

The KE devices don't have this module and the pin multiplexing is 'hard-wired' depending on enabled peripherals.

However there is a GPIOx_PIDR register which the K series doesn't have which needs to be configured before inputs are sampled. Each input is disabled by default (meaning that its value is not sampled and so the value in GPIOx_PDIR doesn't follow it) so clearing its bit in that register allows its state to be subsequently read.

Practically:

1. The ports don't need to be enabled (no peripheral clock needs to be enabled to them)

2. To be able to read the input state the bit in GPIOx_PIDR needs to be set to '0'

3. The present input state can then be read via GPIOx_PDIR

Regards

Mark

µTasker Kinetis support

909 Views
davidsherman
Senior Contributor I

Thanks for the clarification, Mark.  I did think it was strange that the KBI would have to be enabled just to read the pin state, and it does seem to be working without it.

0 Kudos
909 Views
mjbcswitzerland
Specialist V

David

Unfortunately I haven't yet used the KBI so can't comment on it more than saying that I "believe" that it can be used to achieve GPIO interrupts. The K and KL series have port interrupts built into the port configuration module and so such port interrupts are otherwise missing on the KE parts (hence my belief that the KBI fills in here if needed - available on quite a lot of ports bits (but not all); there is also the IRQ input but this is much more limited).

Regards

Mark

Update 7.1.2015:

- KBI support has now been integrated int the uTasker project for KE02/KE04Z40, KE04 and KE06 including simulation. There is a reference at http://www.utasker.com/kinetis/FRDM-KE06Z.html

0 Kudos