Using alternative pin function in LPCxpresso4337

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

Using alternative pin function in LPCxpresso4337

1,022 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pignuts on Wed Sep 30 09:58:40 MST 2015
Hello everyone!

How to configure an alternative function for any pin?
I have this question, even after searching for it in the forum and google.

I´m new to programming ARM and NPX boards, but i did figure how to set GPIO pins and toggle them by going through the examples.
What i can´t figure out is how to use the GPIO function in pins that do not have this function as the first one on the list (function 0).

I tried it with this code:

Chip_SCU_PinMuxSet( 0x5,0x6, SCU_MODE_FUNC4);
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT,0x5, 0x6);


I then toggle the pin using this:
Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0x5, 0x6, false);

and
Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0x5, 0x6, true);


This worked for pins that have GPIO as their function0.

I´m using LPCXpresso v7.9.0.

Any help is appreciated.
Thanks in advance.

0 Kudos
Reply
3 Replies

957 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pignuts on Thu Oct 01 01:58:43 MST 2015
Thanks, guys!

Starblue, your are completely right!
Even after checking the manual and the comments in the code, several times, i did not realize that difference.
It´s working, now.

Thanks for your help.
0 Kudos
Reply

957 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Thu Oct 01 01:15:25 MST 2015
Try the NXP LPC Initializer and pinmux tool to configure pins:
https://www.lpcware.com/LPCUtilities
0 Kudos
Reply

957 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Thu Oct 01 00:47:28 MST 2015
On the LPC43xx there is a distinction between pins and port bits.

For example GPIO5[6] is on pin P2_6, see the chapter "Pin configuration".

The SCU uses pin numbers, while for GPIO it's port number and bit.

So I think
Chip_SCU_PinMuxSet( 0x2,0x6, SCU_MODE_FUNC4);
should do the job (untested, and I'm just guessing about Chip_SCU_PinMuxSet).
0 Kudos
Reply