LPC1769 Arduino GPIO functions

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

LPC1769 Arduino GPIO functions

2,781 Views
lpcware
NXP Employee
NXP Employee

Content originally posted in LPCWare by Superfred on Mon Apr 02 08:18:02 MST 2012
Hello,

 

to simplify my GPIO access I ported some Arduino functions to my LPCXpresso1769:
pinMode
digitalWrite
digitalRead
millis    (needs CMSISv2p00_LPC17xx)
delay   (needs CMSISv2p00_LPC17xx)

 

maybe someone finds it useful, see attachment.
Please note that not all ports are tested, please tell me problems.
Please respond if you are interrested in more functions like beep, serial,...

Original Attachment has been moved to: 1100720_src.zip

10 Replies

1,567 Views
brendonslade
NXP TechSupport
NXP TechSupport

Here is the file from lpcware for your convenience...

0 Kudos

1,567 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Unfortunately the attachments referenced above did not pull across as part of the LPCware forum migration to the NXP community site. But you can currently access the LPCware thread at:

https://www.lpcware.com/content/forum/lpc1769-arduino-gpio-functions

Regards,

LPCXpresso Support

0 Kudos

1,567 Views
cesarmonges
Contributor I

I can´t see the attachment, could you send it to me?

0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Superfred on Tue May 22 22:51:59 MST 2012
Hi kled.89,

sorry for late answer, I was very busy.
I will include serial functions similar to the Arduino Serial.print syntax in my GPIO project (as an alternative to printf which I want preserve for debug messages), give me some days.
Only similar because the Arduino Serial Library is written in C++ and we have only C in LPCXpresso, but it is possible when I rename the functions slightly.


Would this help you?

Fred
0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kled.89 on Sun May 20 11:30:28 MST 2012

Quote: Superfred
Hello kled.89,

You posted the code of a Arduino Software Serial driver.
But you don't need a Software Serial on the 1769 because you have several Hardware Serial Interfaces.

In the examples from LPCXpresso you can find several UART (=Hardware Serial) drivers.
If you have problems to port them please tell me, maybe I can help you.

Fred


Loo



Hi Fred,

I am currently trying to interface the LPC1769 to control the GPRS shield module from Arduino

This website provides a simple setup code for this module in Arduino which I have difficulties trying to understand. http://www.seeedstudio.com/wiki/index.php?title=GPRS_Shield_v0.9b

Would greatly appreciate if you could help. :)

Thanks so much.
0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Superfred on Thu May 17 08:42:14 MST 2012
Hello kled.89,

You posted the code of a Arduino Software Serial driver.
But you don't need a Software Serial on the 1769 because you have several Hardware Serial Interfaces.

In the examples from LPCXpresso you can find several UART (=Hardware Serial) drivers.
If you have problems to port them please tell me, maybe I can help you.

Fred


Loo
0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee

Content originally posted in LPCWare by kled.89 on Wed May 16 20:28:13 MST 2012
Hi I have a open source code from Arduino for a GPRS shiled module.
But I am not sure how to modify the code to suit my LCP1769. Can anyone help? thanks

0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee

Content originally posted in LPCWare by Superfred on Sun May 13 08:30:52 MST 2012
Hello renenguyen,
see description in the manual (user.manual.lpc17xx.pdf):

8.3 Pin function select register values
The PINSEL registers control the functions of device pins as shown below. [B]Pairs[/B] of bits in these registers correspond to specific device pins.

Table 75. Pin function select register bits
PINSEL0 to PINSEL9 Values:
[B]00[/B] Primary (default) function, typically [B]GPIO[/B] port 00
01 First alternate function
10 Second alternate function
11 Third alternate function[/SIZE]

 

3 is the inverted binary "00", and this means GPIO.

 

By the way, I found a small problem in my library for Port2, here is the corrected version:

0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun May 13 02:04:47 MST 2012

Quote: renenguyen

temp = ~(3 << (temp << 1));

what is meaning of "3" in there.



temp = pin;
temp = ~(3 << (temp << 1));
LPC_PINCON->PINSEL0    &= temp;
3 = 2 bits set = 0b0011

This code is resetting 2 bits in PINSEL register

Sample: pin = 2[INDENT] (2 <<1) = 4    //pin *2,  each pin has 2 config bits, so jump to bit 4 for pin 2

(3<< 4)    // set bit 4-5 for pin 2 = 0b0000 0000 0000 0000 0000 0000 00[COLOR=Red]11[/COLOR] 0000

~                              //create one's complement 0b1111 1111 1111 1111 1111 1111 11[COLOR=Red]00[/COLOR] 1111

LPC_PINCON->PINSEL0   &=   // AND = reset bit 4-5 :eek:[/INDENT]
0 Kudos

1,567 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by renenguyen on Sat May 12 17:21:37 MST 2012
Configuring the pin/dir for the LP1769 in Arduino make it easier to use, however i'm still not clear about the line code:
temp = ~(3 << (temp << 1));
what is meaning of "3" in there. Thanks in advance,

rene'
0 Kudos