********************
Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.
-- Martin Fowler, 2008.
********************
********************
INTRO
This repository provides support for the LPC122x microcontroller from NXP
It has support for the core LPC122x functions, as used on the development
modules made by Techno-Innov, and for the peripherals we use on various
boards for our projects (user led, eeprom, temperature sensor, CC1101 RF
transceiver, ...).
Support for various other cool stuff is added when we need it.
Example applications have been exported to a separate git repository, which
must be cloned under "apps" directory.
You can create your own app/[module name] directories for the boards or
projects you create, with one sub-directory for each application. These can
(and should) be git repositories.
These are (and must stay) independent.
Each module has it's own directory under apps/.
More usefull stuff is up to you. Creating an app is *very* simple. Copy
an example from apps/[module name]/ to the name you want and start coding.
** Please, no spaces (or special characters) in the directory names ! **
The examples git repository can be cloned from our server by using the
following command when in the "app" directory :
git clone git://git.techno-innov.fr/lpc122x_examples examples
********************
BUID and FLASH
Build has been tested using gcc, and only gcc, in the version provided by
Devuan GNU/Linux distribution, and a few other binary versions available for
download on the Internet, but any ARM gcc toolchain should do.
In order to get the debian ARM gcc cross-toolchain you should install the
following packaages : gcc-arm-none-eabi, binutils-arm-none-eabi
There's no need for the related libc package here, the libc does not fit
in our micro-controller memory. Instead have a look at the content of the
lib/ directory, and add stuff there.
Once done you should build using the provided makefile by running the
simple "make" command in the base directory, which will build all apps, or
run "make <module_name>/<app_name>" to build a specific application.
You can also run the simple "make" command in the specific app subdirectory
to compile this application alone.
The build includes all C files from the app directory, and the resulting binary
gets the app name (directory name).
The provided Makefiles display some information about the size and memory
usage of the generated binary.
To flash the binary (the file ending with ".bin") to the embedded LPC Flash you
will need the lpctool package, now packaged for Debian (starting with Jessie),
or available in our git repository : http://git.techno-innov.fr/lpctools (Clone
using : git clone http://gitclone.techno-innov.fr/lpctools and then build
(make) and use :)
Usual command lines :
lpcprog -d /dev/ttyUSB0 -c id
lpcprog -d /dev/ttyUSB0 -c flash app_name.bin
See lpctools readme and lpcprog or isp help (-h) or manpages for more
information.
For easier use of lpcprog in the usual case it is possible to define an alias
such as the following one, which you can add to your shell ressources file :
alias prog='lpcprog -d /dev/ttyUSB0 -c flash $(basename $PWD).bin'
This alias will call lpcprog on the most commonly used tty device (for me at
least) and try to flash the file ending in ".bin" which has the same name as
the current directory (which is what the apps Makefiles produces).
********************
SUPPORTED FEATURES and INTERFACES
- LPC122x micro-controller definitions
- Cortex-M0 specific definitions
- Cortex-M0 and LPC122x Registers
- Interrupts
- ROM based division routines
- Utility functions to replace ctz and clz instructions (not present in Cortex M0)
- IAP ROM based functions (tested for user flash access only)
- Bootstrap
- vector table
- reset handler
- System
- flash accelerator configuration
- watchdog (stop)
- clock / PLL config
- systick
- precise msleep and usleep functions (using systick)
- pio configuration
- deep power down
- Simple C Library
- memcpy and memset
- strcpy, strncpy, strcmp, strncmp, strchr, strrchr, strlen, strnlen
- snprintf, vsnprintf
- Integrated Interface drivers
- UART (as UART or RS485)
- I²C
- ADC
- GPIO
- GPIO interrupts
- Counter / Timers
- SPI (SSP)
- PWM
- RTC (partial)
- Watchdog
- External Device drivers
- I²C EEPROM
- TMP101 I²C temperature sensor
- CC1101 Sub 1GHz RF Transceiver
- Status led
- Epaper display
- WS2812 chainable leds
- LCD Character displays
- Maxim Max31855 thermocouple to digital converters
- On semiconductor NCN5120 KNX bus interface (under test)
- VEML6070 I²C UV sensor
- TSL256x ambiant and IR light sensor (obsolete)
- BME280 triple sensor (temperature, pressure and humidity)
- BQ769x0 multi-cell BMS (Battery management)
- PCF85363 RTC
- SD/MMC cards
- SSD130x Oled displays
- ST7735 TFT displays
- Other
- CRC-CITT
- 8x8 font for use with Epaper display
- DTPlug (or any host) communication protocol
- MQTT communication protocol
********************
TODO :
- Test all the GPIO in different modes
- Complete RTC Support
- Comparator support
- CRC engine support
- Test UART IrDA mode
- DTPlug communication protocol tests + continue development of other functionalities.
- Continue tests for NCN5120 support
- More external drivers !
- Fix DHT11 temperatur and Humidity sensor support