-
Notifications
You must be signed in to change notification settings - Fork 9
Story
Arduino UNO WiFi Developer Edition got a sticker 'weird wiring'. The reason is the additional UART for connecting the ESP8266.
Arduino.org developers took the UART_Bridge library from Sandbox Electronics the manufacturer of a module with SC16IS750. (Manufacturer of SC16IS750 is NXP).
The SC16IS750 library from Sandbox Electronics sends every byte immediately over I2C with overhead of device address, register address byte and I2C protocol bytes. And it reads the rx byte by byte, again with the overhead of address and protocol. With arduino default twi frequency of 100 kHz this leads to a very slow communication. For this reason they set the baud rate in firmware and library to 9600, later in WiFi Link to 19200 baud. It is not better than SoftwareSerial.
The purpose of the UnoWiFiDevEd libray EspRecovery sketch is to bridge the Serial interface connected over USB to computer with the SC16IS750 interface for esp flashing tools. It can work only at 9600 baud because of the Sandbox Electronics SC16IS750 library.
UnoWiFiDevEdSerial1 is a new implementation of SC16IS750 written for the UNO WiFi usage. For read and write it uses buffers optimized to the Wire library implementation buffer size. All bytes available in SC16IS750 FIFO buffer are read at once into library's buffer and the served from it. Bytes written over Serial1 are collected into a buffer and send in one I2C package if the buffer is full or flush is called. Arduino programmers are not used to call flush after last byte written, so the library calls flush if bytes are read.
UnoWiFiDevEdSerial1 sets high speed I2C frequency if begin is called with more the 57600 baud and it can work at 230400 baud.
The name of the Serial1 object, which is the single instance of the UnoWiFiDevEdSerial1, clarifies the purpose of the interface. The library even defines that the UNO WiFi has hardware Serial1.
Important ESP8266 pins are wired to SC16IS750 GPIO pins on UNO WiFi. The UnoWiFiDevEdSerial1 used it to implement a reset to bootloader mode for the EspProxy tool.
The EspProxy sketch replaces the EspRecovery sketch from UnoWiFiDevEd library and WiFi Link library. EspRecovery with Serial1 can bridge flashing tools to ESP at default 115200 baud. Only the helper stub is written very fast from tools memory and Serial overflows occur. The workaround in EspProxy is doubling the speed at Serial1 side for the flashing mode.