Frdm-k64g Gpio Issue

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

Frdm-k64g Gpio Issue

Jump to solution
1,095 Views
alejandrovelez
Contributor III

Hello... I need to toggle some of the FRDM-K64F GPIO pins. One of those pins is in the PTA port, the PTA2 pin, but I can't set it to  logic '1', it's always at 0V and I need to set it to it's logic '1' state of 3.3V. I have tried a baremetal code, I can set other pins except this one. The pins is shared with the JTAG_TDO and I think that's the reason. Can I get this pin to work as GPIO??

Thanks

Here's my initialization code:

SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;         //Enable clock

PORTA_PCR2 |= PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;   //Chose alt1 as gpio pin and enable drive strenght

GPIOA_PDDR |= (1<<2);   //Set the pin as output

GPIOA_PSOR |= (1<<2);   //To set the pin at logic '1' but doesn't work :smileysad:

0 Kudos
1 Solution
848 Views
mjbcswitzerland
Specialist V

Hi

Change the line
PORTA_PCR2 |= PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;   //Chose alt1 as gpio pin and enable drive strenght
to
PORTA_PCR2 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;   //Chose alt1 as gpio pin and enable drive strenght
and it will work.


In the uTasker project you would simply do
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, (PORTA_BIT2), (PORTA_BIT2), (PORT_DSE_HIGH)); // configure and drive '1' on PTA2
and nothing can go wrong.

Regards

Mark

http://www.utasker.com/kinetis/FRDM-K64F.html

View solution in original post

5 Replies
847 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Alejandro,

Mark is right.

The PORTA_PCR2[MUX]=0x07 as default. So you need PORTA_PCR2 = PORT_PCR_MUX(1) instead of PORTA_PCR2 |= PORT_PCR_MUX(1).

PTA2.png

Best Regards,

Robin

 

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

847 Views
alejandrovelez
Contributor III

Thanks Robin, you're right!!

Regards

0 Kudos
849 Views
mjbcswitzerland
Specialist V

Hi

Change the line
PORTA_PCR2 |= PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;   //Chose alt1 as gpio pin and enable drive strenght
to
PORTA_PCR2 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;   //Chose alt1 as gpio pin and enable drive strenght
and it will work.


In the uTasker project you would simply do
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, (PORTA_BIT2), (PORTA_BIT2), (PORT_DSE_HIGH)); // configure and drive '1' on PTA2
and nothing can go wrong.

Regards

Mark

http://www.utasker.com/kinetis/FRDM-K64F.html

847 Views
alejandrovelez
Contributor III

Thanks Mark, it works!!

I don't know the uTasker tool, can you please give me more information about it or where I can find it?  Thanks

Regards

0 Kudos
847 Views
mjbcswitzerland
Specialist V

Hi Alejandro

Link at end of previous post.

Regards

Mark

0 Kudos