fanhuafeng / sc16is752-esp

Sample app for ESP8266 controlling the SC16IS752 I2C UART IC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple program to control the NXP SC16IS752 dual UART with I2C/SPI interface

This program:
- Uses the I2C interface
- Registers an interrupt handler to listen for interrupts from the device
- Soft resets the device
- Initialises the device at adress 0x48 (A0 and A1 pulled to VDD)
- Blinks GPIOs 0 and 1
- Sends "Hello World" at 2400,8,N,1
- Waits a while for received data - and if received outputs it to console
- Performs a hard reset of the device, by pulling the RESET pin low
- Outputs some stats
- Starts again

This was verified using an otb-iot v0.5 based on an ESP-12F board, driving an SC16IS752 with a 1.8432MHz crystal.  Other SC16IS7XX devices may also work, in particular:
- SC16IS752
- SC16IS762
- SC16IS750
- SC16IS760

It's unlikely to work with the SC16IS740 as that device has no GPIOs.

To build and install run:

  make flash && make con74

to flash the module and then connect to it over the console interface.

If you don't have an ESP8266 build environment and are using linux, use the piersfinlayson/esp8266-build container.  To use it run docker as follows:

  docker run --rm --name esp8266-build-usb -ti -v ~/container-data/builds:/home/esp/builds --device /dev/ttyUSB0:/dev/ttyUSB0 piersfinlayson/esp8266-build

Here ~/container-data/builds is a directory on the host containing the sc16is752-esp repo, and the ESP8266 device is connected to /dev/ttyUSB0 on the host.  Then run:

  cd sc16is752-esp

Followed by the build commands above.

The baud rate of the ESP8266 is assumed to be 74,880 (using the default 26KHz crystal).

About

Sample app for ESP8266 controlling the SC16IS752 I2C UART IC

License:GNU General Public License v3.0


Languages

Language:C 89.0%Language:C++ 9.4%Language:Makefile 1.7%