KW47: Using GPIO Port D

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

KW47: Using GPIO Port D

602 Views
alanlow
Contributor II

Hi,

I realized that there is no definition of kCLOCK_GpioD and kCOCK_PortD in the fsl_clock.h.

Is there any sample code to initialize Port D for KW47?

 

Thanks.

0 Kudos
Reply
4 Replies

568 Views
sofiaurueta
NXP Employee
NXP Employee

Hello, 
Hope you are doing well. 

 

There is an example in the SDK that uses PTD1. You could use that implementation as a reference for configuring the PORT D GPIO. 

Although using Config Tools with wireless examples is not recommended as it may modify required configurations, you can create a blank project to generate the code that enables the port using Config Tools and then manually copy that code into your existing project. 

 

Best regards, 
Ana Sofia. 

0 Kudos
Reply

564 Views
alanlow
Contributor II
Hi Sofia,

Thanks for your quick response. May I know which example you are reference?

Thanks!
0 Kudos
Reply

530 Views
sofiaurueta
NXP Employee
NXP Employee

Hello,

The implementation is included in the SDK, please see in pin_mux.c file, the function BOARD_InitPinButton0 which configures the pin routing for PTD1, as well as defines for GPIOD, PORTD in pin_mux.h file.

 

Best regards,
Ana Sofia.

0 Kudos
Reply

583 Views
tejoka5968
Contributor I

Hello!

On KW47, there are no kCLOCK_GpioD or kCLOCK_PortD definitions in fsl_clock.h because Port D isn’t part of the KW47 clock tree. Only ports A, B, C, and E are supported. To initialize a port, enable its clock with CLOCK_EnableClock(kCLOCK_PortX), set the pin mux using PORT_SetPinMux(), and then configure the GPIO with GPIO_PinInit(). For reference, check the KW47 SDK GPIO demos (like LED toggle) which show the correct initialization flow. 

0 Kudos
Reply