diff --git a/examples/esp32/uart-bridge/README.md b/examples/esp32/uart-bridge/README.md index f44d741f..6e60fad4 100644 --- a/examples/esp32/uart-bridge/README.md +++ b/examples/esp32/uart-bridge/README.md @@ -1,30 +1,10 @@ # A UART to network bridge for ESP32 -This example is a demonstration of how Mongoose Library could be integrated -into an embedded device and provide a UART-to-Network bridge capability: - -- A device opens listening TCP port and Websocket port and waits for connections -- When a client connects, data is exchanged with the device's UART -- Everything that client send, is sent to the UART -- Everything that is read from the UART, gets sent to the client -- Multiple clients are allowed -- Live UART console allows to talk to the UART from the web page -- Web UI is hardcoded into the binary and does not need a filesystem - -# Screenshots - ![](../../uart-bridge/screenshots/dashboard.png) -# Build and flash +- See detailed tutorial at https://mongoose.ws/tutorials/esp32/uart-bridge/ -Build requires Docker installed, and uses Espressif's ESP-IDF docker image: - -```sh -make build -make flash PORT=/dev/YOURSERIAL -``` - -# Flash pre-built firmware +## Flash pre-built firmware You can flash a pre-built firmware to the ESP32 device using the following instructions: diff --git a/examples/esp8266/http-client-server/README.md b/examples/esp8266/http-client-server/README.md index 61fa661e..097cc2f5 100644 --- a/examples/esp8266/http-client-server/README.md +++ b/examples/esp8266/http-client-server/README.md @@ -1,22 +1 @@ -# An example ESP8266 application - -To build this application, follow these steps: - -1. Make sure you have Docker installed -2. Clone whole mongoose repository on your machine: - ```sh - git clone https://github.com/cesanta/mongoose.git - ``` -3. Start command line or terminal, and go into the example's directory: - ```sh - cd mongoose/examples/esp8266 - ``` -4. Run `make`. This invokes a Docker-based build. A firmware will be built - in the `src/build/` directory: - ```sh - make build - ``` -5. Flash your ESP8266. If you have esptool.py installed, the build process will end telling you the command to flash your device. You can just run `make` again to use Docker: - ```sh - make flash PORT=/your/serial - ``` +See detailed tutorial at https://mongoose.ws/tutorials/esp8266/http-client-server/ \ No newline at end of file diff --git a/examples/ti/ek-tm4c1294xl-baremetal/Makefile b/examples/ti/ek-tm4c1294xl-baremetal/Makefile index f68f8c5c..7aaa9c73 100644 --- a/examples/ti/ek-tm4c1294xl-baremetal/Makefile +++ b/examples/ti/ek-tm4c1294xl-baremetal/Makefile @@ -40,7 +40,7 @@ DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/1 update: firmware.bin curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @$< -test update: CFLAGS_EXTRA += -DUART_DEBUG=UART1 +test update: CFLAGS_EXTRA += -DUART_DEBUG=UART0 test: update curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt grep 'READY, IP:' /tmp/output.txt # Check for network init diff --git a/examples/ti/ek-tm4c1294xl-baremetal/hal.h b/examples/ti/ek-tm4c1294xl-baremetal/hal.h index 457d2999..d116f7ed 100644 --- a/examples/ti/ek-tm4c1294xl-baremetal/hal.h +++ b/examples/ti/ek-tm4c1294xl-baremetal/hal.h @@ -133,22 +133,18 @@ static inline void gpio_irq_attach(uint16_t pin) { #define UARTNO(u) ((uint8_t) (((unsigned int) (u) -UART0_BASE) / UART_OFFSET)) static inline void uart_init(UART0_Type *uart, unsigned long baud) { - struct uarthw { - uint16_t rx, tx; // pins - uint8_t af; // Alternate function - }; - // rx, tx, af for UART0,1,2 - struct uarthw uarthw[3] = {{PIN('A', 0), PIN('A', 1), 1}, - {PIN('B', 0), PIN('B', 1), 1}, - {PIN('A', 6), PIN('A', 7), 1}}; // or PD4, PD5... - + uint8_t af = 1; // Alternate function + uint16_t rx = 0, tx = 0; // pins uint8_t uartno = UARTNO(uart); + SYSCTL->RCGCUART |= BIT(uartno); // Enable peripheral clock - gpio_init(uarthw[uartno].tx, GPIO_MODE_AF, GPIO_OTYPE_PUSH_PULL, - GPIO_SPEED_HIGH, 0, uarthw[uartno].af); - gpio_init(uarthw[uartno].rx, GPIO_MODE_AF, GPIO_OTYPE_PUSH_PULL, - GPIO_SPEED_HIGH, 0, uarthw[uartno].af); + if (uart == UART0) tx = PIN('A', 0), rx = PIN('A', 1); + if (uart == UART1) tx = PIN('B', 0), rx = PIN('B', 1); + if (uart == UART2) tx = PIN('A', 6), rx = PIN('A', 7); // or PD4, PD5... + + gpio_init(tx, GPIO_MODE_AF, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, 0, af); + gpio_init(rx, GPIO_MODE_AF, GPIO_OTYPE_PUSH_PULL, GPIO_SPEED_HIGH, 0, af); // (16.3.2) ClkDiv = 16 (HSE=0) // BRD = BRDI + BRDF = UARTSysClk / (ClkDiv * Baud Rate) // UARTFBRD[DIVFRAC] = integer(BRDF * 64 + 0.5)