138 lines
3 KiB
Markdown
138 lines
3 KiB
Markdown
+++
|
|
date = 2012-06-10T00:00:00+00:00
|
|
title = "LPC1114 Temperature Sensor"
|
|
tags = ["embedded"]
|
|
+++
|
|
|
|
The idea is to use the Cortex-M0 based LPC1114 as a low power micro in a
|
|
remote temperature sensor. Use a solar light as the case and power
|
|
source and it should run forever.
|
|
|
|
Use the [Olimex](http://olimex.com/)
|
|
[LPC-H11U14](http://olimex.com/dev/lpc-h11xx.html) as a breakout board.
|
|
|
|
Initial code is at <http://juju.net.nz/src/lpc1114.git/>
|
|
|
|
[Datasheet](http://www.nxp.com/documents/data_sheet/LPC111X.pdf) [User
|
|
manual](http://www.nxp.com/documents/user_manual/UM10398.pdf)
|
|
|
|
## Hardware
|
|
|
|
LPC1114FBD48/302:
|
|
|
|
- LPC1100L
|
|
|
|
- 38 x 38 mm
|
|
|
|
- 32 k flash, 8 k RAM, UART, 2x SSP, I2C, ADC
|
|
|
|
- TMP102 0.5 deg C?
|
|
|
|
microbuilder reference design:
|
|
|
|
- NCP1402 converter. 0.8 V startup, 200 mA, various outputs.
|
|
- 24AA32AFT. Microchip I2C 4 k x 8 EEPROM
|
|
|
|
`PIO0_7` (23) is a 20 mA high current driver. The I2C lines are high
|
|
current sinks. A white LED has a ~3.5 V drop. Red is ~1.6 V and
|
|
yellow/green ~2.0 V at 10 mA. 10 mA for a (5 V - 1.8 V) drop = 320 Ohms.
|
|
|
|
Regulator is a LDO (1.2 V) 800 mA LM1117. Steering diodes give another
|
|
0.6 V so it shouldn't work :)
|
|
|
|
`IOCON` set the routing for different signals like the SPI clock.
|
|
|
|
Two SPI ports:
|
|
|
|
- SPI0: SCK0/PIO0\_6 (22), MISO0/PIO0\_8 (27), MOSI0/PIO0\_9 (28),
|
|
SSEL0/PIO0\_2 (10)
|
|
- SPI1: SCK1/PIO2\_1 (13), MISO1/PIO2\_2 (26), MOSI1/PIO2\_3 (38),
|
|
SSEL1/PIO2\_0 (2)
|
|
|
|
## Power
|
|
|
|
The dev board has a LM1117IMPX-ADJ and 240R + 390R divider. V = IR so I
|
|
= 5.2 mA\!
|
|
|
|
1.8 to 3.6 V supply. Must boost.
|
|
|
|
1 mA at 6 MHz. 5 mA at 50 MHz.
|
|
|
|
## Code
|
|
|
|
- <https://github.com/microbuilder/LPC1114CodeBase>
|
|
- mbed is a LPC11U24 but I can't find the library code
|
|
- <http://www.microbuilder.eu/>
|
|
|
|
## Speed
|
|
|
|
0.98 CoreMark/MHz with Code Red GCC 4.3.3.
|
|
|
|
## Bootloader
|
|
|
|
The built in bootloader seems fine. ASCII/uuencode based with auto baud.
|
|
Starts the user program if 'valid' based on the vectors checksum.
|
|
|
|
Pins:
|
|
|
|
- `#RESET/PIO0_0` / pin 3
|
|
- `PIO0_1` / pin 4 low on reset to enter the loader
|
|
- `RXD/PIO1_6` / pin 46
|
|
- `TXD/PIO1_7` / pin 47
|
|
|
|
Protocol:
|
|
|
|
- `?` -\>
|
|
- \<- `Synchronized<CR><LF>`
|
|
- `Synchronized<CR><LF>` -\>
|
|
- \<- `OK<CR><LF>`
|
|
|
|
Use my FTD2232 based JTAG?
|
|
|
|
## Interface
|
|
|
|
Use one of the Nokia DKU-5 clones from Trademe.
|
|
|
|
`+5V TXD DTR RXD GND`
|
|
|
|
`RTS ??? ??? ??? ???`
|
|
|
|
DTR and RTS can map to reset and BSL. Matches the [Sparkfun
|
|
one](http://www.sparkfun.com/products/714).
|
|
|
|
Looking from the bottom of the IDC, I have:
|
|
|
|
`| | | |`
|
|
|
|
`1 2 3 4 5`
|
|
|
|
`6 7 8 9 10`
|
|
|
|
- 1 = RTS
|
|
- 2 = TXD
|
|
- 3 = RXD
|
|
- 4 = --
|
|
- 6 = +5V
|
|
- 7 = DTR
|
|
- 8 = GND
|
|
- 5, 9, 10 = NC
|
|
|
|
## Memory map
|
|
|
|
Bootloader:
|
|
|
|
- 0 - 0x7FFF: Flash in 4 k sectors
|
|
- 0x10000000 + 8 k: RAM
|
|
- RAM + 0x17C to 0x025B: ISP work area
|
|
- Upper 32 bytes of RAM: Flash work area
|
|
- Top of RAM - 32 bytes: top of stack
|
|
|
|
## Hookups
|
|
|
|
I have a [MOD-NRF24LR](http://olimex.com/dev/mod-nrf24L.html). NRF24L01.
|
|
SPI based.
|
|
|
|
And a [MOD-LCD3310](http://olimex.com/dev/mod-lcd3310.html). 84x48. SPI
|
|
based. Needs an extra data/command line.
|
|
|