read whole port in kinetis KL46

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

read whole port in kinetis KL46

1,120 次查看
piotrdzierzak
Contributor II

I have a trivial problem with kinetis KL46.
Could anyone show me the easiest way to:

1. Configured port C as an input and with the internal pullup resistor

2. Read all port in Kinetis KL46 (for example PTC)

I try to use Processor Expert but without success…

To do this I used:

  • to set internal pullup resistors I used PTC:Init_GPIO component
  • to read all port I used GPIO_LDD and method GetPortValue

Im using "sharing pin"... It doesn't work. What am I doing wrong?

In Freescale is not possible to configure in Processor Expert portC as input and with internal pullup resistors???

Second: do you also have some stupid communicats from Kinetis Design Studio: "Unhandled event loop exception No more handles".

This communicate appear frequently when I only CLICK by mouse in edit windows.....

0 项奖励
回复
2 回复数

713 次查看
marek_neuzil
NXP Employee
NXP Employee

Hello Piotr,

If you want to use port C, you can use the Init_GPIO for configuration of all pins. There are two main group in this component - Settings and Pin selection/routing.

Settings group allows configuration of the electrical properties, pin direction and output value of every pin.

Pin selection/routing group allows configuration of pin mux control  (selection of pins as GPIO).

pastedImage_7.png

The initialization code is generated in the PE_low_level_init() function in Cpu.c program module (PORTC_PCRx registers) and in the PTC_Init() function in PTC.c (Init_GPIO) program module.

Therefore you needn't use GPIO_LDD component. You can just use PDD macros for reading input value of the PTC, see for example following code:

. . .

#include "GPIO_PDD.h"

/* User includes (#include below this line is not maintained by Processor Expert) */

/*lint -save  -e970 Disable MISRA rule (6.3) checking. */

int main(void)

/*lint -restore Enable MISRA rule (6.3) checking. */

{

  uint32_t port_val;

  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */

  /* For example: for(;;) { } */

  port_val = GPIO_PDD_GetPortDataInput(PTC_DEVICE);

  . . .

Note:

Please, don't use the "sharing pin". This functionality can be used when you need sharing of one pin by two devices (e.g. UART - TxD pin and GPIO pin). The functionality can be switched during runtime by using ConnectPin method (see the help page Processor Expert Software - Kinetis Design Studio > Processor Expert User Guide > Application Design > Configuring Components > Sharing Pins Among Peripherals in KDS 3.0.0).

Best Regards,

Marek Neuzil

713 次查看
piotrdzierzak
Contributor II

Hello Marek,

With big delay - but thank you for your interest and for your professional help.
Best Regards

Piotr Dzierzak

0 项奖励
回复