summaryrefslogtreecommitdiff
path: root/lpc23xxnotes.mdwn
blob: ead8eaa9ab71c430858882752a1ce6034647284b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
[[!toc levels="6"]]


# LPC 2378 OLIMEX Board Notes

## Buttons

Button 1 (BUT1) - P0.30/U1D- (pin 43) NOTE: P0.30 is tied to P0.29 in odd ways, read user manual ch10 5.1!!!

Button 2 (BUT2) - P0.6/I2SRX_SDA/SSEL1/MAT2.0 (pin 113)
pinned out on ext2-3

## LEDs

STAT (STAT) - P1.19/CAP1.1 (pin 47)  (wtf? seriously, what's this for???)
whatever it is, it's active low, and not pinned out anywhere just yet.  

The 2 green LEDs that have been added to the proto section of the board run at around 1.7 mA when powered straight from 3.3 V, and emit a dim luminosity.  I'm assuming these are under voltage/under current and fine to run directly without a limiting resistor.


## GPIO setup 

- NOTE:  WHY DOES GPIO 2 BOUNCE???  

### SCS  bit 0 (0xE01F C1A0) controls the GPIO "mode"
from the docs:
0 GPIO ports 0 and 1 are accessed via APB addresses in a fashion
  compatible with previous LPC2000 devices.
1 High speed GPIO is enabled on ports 0 and 1, accessed via addresses in
  the on-chip memory range. This mode includes the port masking feature
  described in the GPIO chapter.

### Steps to set up the GPIO:

1. ensure correct SCS if using GPIO 0 or 1
2. consider masks (should this get masked before direction comes up???)
3. set or clear the direction register FIOxDIR (1 should be output)

 
LPC2364/65/66/67/68

100 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 0 pins depends upon the pin function selected via
the pin connect block. Pins 12, 13, 14, and 31 of this port are not available.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 1 pins depends upon the pin function selected via
the pin connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not
available.

Port 2: Port 2 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 2 pins depends upon the pin function selected via
the pin connect block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 3 pins depends upon the pin function selected via
the pin connect block. Pins 0 through 24, and 27 through 31 of this port are
not available.

Port 4: Port 4 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 4 pins depends upon the pin function selected via
the pin connect block. Pins 0 through 27, 30, and 31 of this port are not
available.

---

LPC2377/78

144 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 0 pins depends upon the pin function selected via the pin connect
block.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 1 pins depends upon the pin function selected via the pin connect
block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32 bit I/O port with individual direction controls for each bit. The
operation of port 2 pins depends upon the pin function selected via the pin connect
block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32 bit I/O port with individual direction controls for each bit. The
operation of port 3 pins depends upon the pin function selected via the pin connect
block. Pins 8 through 22, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32 bit I/O port with individual direction controls for each bit. The
operation of port 4 pins depends upon the pin function selected via the pin connect
block. Pins 16 through 23, 26, and 27 of this port are not available.

---

LPC2387

100 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 0 pins depends upon the pin function selected via the Pin Connect
block. Pins 12, 13, 14, and 31 of this port are not available.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 1 pins depends upon the pin function selected via the Pin Connect
block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 2 pins depends upon the pin function selected via the Pin Connect
block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 3 pins depends upon the pin function selected via the Pin Connect
block. Pins 0 through 24, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 4 pins depends upon the pin function selected via the Pin Connect
block. Pins 0 through 27, 30, and 31 of this port are not available.

---

LPC2388

144 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 0 pins depends upon the pin function selected via the Pin Connect
block.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The
operation of port 1 pins depends upon the pin function selected via the Pin Connect
block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32 bit I/O port with individual direction controls for each bit. The
operation of port 2 pins depends upon the pin function selected via the Pin Connect
block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32 bit I/O port with individual direction controls for each bit. The
operation of port 3 pins depends upon the pin function selected via the Pin Connect
block. Pins 8 through 22, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32 bit I/O port with individual direction controls for each bit. The
operation of port 4 pins depends upon the pin function selected via the Pin Connect
block. Pins 16 through 23, 26, and 27 of this port are not available.

---

100 pin packages

To enable GPIO

    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 0.0	PINSEL0	1:0  	00
    PORT 0.1	PINSEL0	3:2  	00
    PORT 0.2	PINSEL0	5:4  	00
    PORT 0.3	PINSEL0	7:6  	00
    PORT 0.4	PINSEL0	9:8  	00
    PORT 0.5	PINSEL0	11:10	00
    PORT 0.6	PINSEL0	13:12	00
    PORT 0.7	PINSEL0	15:14	00
    PORT 0.8	PINSEL0	17:16	00
    PORT 0.9	PINSEL0	19:18	00
    PORT 0.10	PINSEL0	21:20	00
    PORT 0.11	PINSEL0	23:22	00
    PORT 0.15	PINSEL0	31:30	00


    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 0.16	PINSEL1	1:0  	00
    PORT 0.17	PINSEL1	3:2  	00
    PORT 0.18	PINSEL1	5:4  	00
    PORT 0.19	PINSEL1	7:6  	00
    PORT 0.20	PINSEL1	9:8  	00
    PORT 0.21	PINSEL1	11:10	00
    PORT 0.22	PINSEL1	13:12	00
    PORT 0.23	PINSEL1	15:14	00
    PORT 0.24	PINSEL1	17:16	00
    PORT 0.25	PINSEL1	19:18	00
    PORT 0.26	PINSEL1	21:20	00
    PORT 0.27	PINSEL1	23:22	00
    PORT 0.28	PINSEL1	25:24	00
    PORT 0.29	PINSEL1	27:26	00
    PORT 0.30	PINSEL1	29:28	00


    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 1.0	PINSEL2	1:0  	00
    PORT 1.1	PINSEL2	3:2  	00
    PORT 1.4	PINSEL2	9:8  	00
    PORT 1.8	PINSEL2	17:16	00
    PORT 1.9	PINSEL2	19:18	00
    PORT 1.10	PINSEL2	21:20	00
    PORT 1.14	PINSEL2	29:28	00
    PORT 1.15	PINSEL2	31:30	00


    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 1.16	PINSEL3	1:0  	00
    PORT 1.17	PINSEL3	3:2  	00
    PORT 1.18	PINSEL3	5:4  	00
    PORT 1.19	PINSEL3	7:6  	00
    PORT 1.20	PINSEL3	9:8  	00
    PORT 1.21	PINSEL3	11:10	00
    PORT 1.22	PINSEL3	13:12	00
    PORT 1.23	PINSEL3	15:14	00
    PORT 1.24	PINSEL3	17:16	00
    PORT 1.25	PINSEL3	19:18	00
    PORT 1.26	PINSEL3	21:20	00
    PORT 1.27	PINSEL3	23:22	00
    PORT 1.28	PINSEL3	25:24	00
    PORT 1.29	PINSEL3	27:26	00
    PORT 1.30	PINSEL3	29:28	00
    PORT 1.31	PINSEL3	31:30	00


    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 2.0	PINSEL4	1:0  	00
    PORT 2.1	PINSEL4	3:2  	00
    PORT 2.2	PINSEL4	5:4  	00
    PORT 2.3	PINSEL4	7:6  	00
    PORT 2.4	PINSEL4	9:8	 	00
    PORT 2.5	PINSEL4	11:10	00
    PORT 2.6	PINSEL4	13:12	00
    PORT 2.7	PINSEL4	15:14	00
    PORT 2.8	PINSEL4	17:16	00
    PORT 2.9	PINSEL4	19:18	00
    PORT 2.10	PINSEL4	21:20	00
    PORT 2.11	PINSEL4	23:22	00
    PORT 2.12	PINSEL4	25:24	00
    PORT 2.13	PINSEL4	27:26	00


    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 3.25	PINSEL7	19:18	00
    PORT 3.26	PINSEL7	21:20	00


    PORT.PIN	PINSELx	BITS	SETTING
    ---- ---	-------	----	-------
    PORT 4.28	PINSEL9	25:24	00
    PORT 4.29	PINSEL9	27:26	00

---

144 pin packages

To enable GPIO

##ADC Setup

### To set up the ADC

1. On reset, the ADC is disabled. 
2. To enable the ADC, first set the PCADC bit (bit 12 in PCONP - address 0xE01F C0C4) and then enable the ADC (bit PDN in AD0CR - address 0xE003 4000)
3. To disable the ADC, first clear the PDN bit, and then clear the PCADC bit.

### ADC pins

* AD0.0 P0.23, PINSEL1 15:14 set to 01 
* AD0.1 P0.24, PINSEL1 17:16 set to 01
* AD0.2 P0.25, PINSEL1 19:18 set to 01
* AD0.3 P0.26, PINSEL1 21:20 set to 01
* AD0.4 P1.30, PINSEL3 29:28 set to 11
* AD0.5 P1.31, PINSEL3 31:30 set to 11
* AD0.6 P0.12, PINSEL0 25:24 set to 11 (not available in 2368!)
* AD0.7 P0.13, PINSEL0 27:26 set to 11 (not available in 2368!)

##I2C setup

### Asumptions

1. Will treat transmits and receives as sort of "atomic" A send will complete before a receive may begin and vice versa.
2. The data counter may be a separate global for each I2C interface.