* fix mbedtls bad pointer in function call (prototype mismatch) * fix issue with weak families functions implemented in static library, it will never be linked. fixed by redefining prototypes inside families * [ln882x] add support for lightning ln882x & ln882h families * add i2c (wire) support * add analog (adc) support * add watchdog support * [ln882x] changed default uart 0/1 pins; added board wl2s * [ln882x] fix IRQ & ADC pins * [ln882x] boards cosmetic * [ln882x] wifi sta use otp mac addr by default; re-enabled wifi powersave mode * [ln882x] clang-format clean code * [ln882x] clang-format clean code * Update families.json * Apply suggestions from code review * [ln882x] reformat json board files * [ln882x] os_queue cleanup * [ln882x] removed Beken auto-download command * [ln882x] removed personal script file * [ln882x] removed unusefull pi section in debugging.md * [ln882x] removed Arduino.h and changed private I2C definition * [ln882x] updated README.md * [ln882x] changed pin naming scheme to PA/PB * [ln882x] clean code * [ln882x] clean code * [ln882x] add ota image verification * Update push-dev.yml * [ln882x] fix boards ADC missing inputs] * [ln882x] removed reg_xxx fixup files and use include guards instead * [ln882x] cleanup code * [ln882x] cleanup code * [ln882x] fix lt_init weak functions linking * [ln882x] revert lt_api.h modification, fixed with previous commit * [ln882x] setup UF2 firmware for flasher with partitions * [ln882x] update README.md * [ln882x] include ln_wifi.h and ln_serial.h to avoid including bad headers on case insensitive systems * [ln882x] Replace RingBuffer by SerialRingBuffer * [ln882x] clang-format * [ln882x] update README.md * Apply suggestions from code review * Reformat board JSON files * Add mkdocs link redirect * Update ltchiptool to v4.12.0 --------- Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
4.4 KiB
Lightning LN882x
Introduction
Lightning LN882x is a family of Wi-Fi and BLE microcontrollers designed for indoor short-range IoT.
Features:
- 32-bit Cortex M4F CPU (160 MHz)
- 296 KiB SRAM
- built-in 512 KiB to 2 MiB flash with XiP
- 802.11b/g/n Wi-Fi
- Bluetooth 5.1 (LN882H only)
Resources:
- LN882H : MCU Combo Wi-Fi/BLE IoT
- LN882H Datasheet : LN882H Datasheet
- LN882H DOC : Official LN882H Document Collection
- LN882H SDK : Official LN882H SDK
- LN882X SDK : Official LN882X SDK
- LN8825A/B : Wi-Fi SOC
- LN8825A/B SDK : Official LN8825A/B SDK
- Flashing tool (GUI) : Flashing tool with GUI (chinese)
- Flashing tool (CMD) : Command-line Flashing tool
Finding your board
{% include-markdown "../../inc/find-board.md" %}
Flashing
{% include-markdown "../../inc/flashing-note.md" %}
LN882x has two UART ports - The UART0 port is used for flashing and text output.
You need to find which pins correspond to UART0 TX and RX. If your board is supported, you'll find the pinout on its documentation page. Otherwise (and for generic boards), you'll have to find the pinout online.
Wiring
Connect UART0 of the LN882H to the USB-TTL adapter:
| PC | LN882H |
|---|---|
| RX | TX0 (GPIOA2 / P2) |
| TX | RX0 (GPIOA3 / P3) |
| GND | GND |
{% include-markdown "../../inc/uart-power.md" %}
{% include-markdown "../../inc/uart-cen.md" %}
The download mode is entered when the chip communicates with the flasher program. Hence, the first step is running the flasher program (described below). While the program is trying to establish communication, the chip has to be rebooted. In order to do that, you need to bridge BOOT1 pin to GND with a wire before powering the chip.
After linking with the chip, the flasher program will begin writing (or reading) the firmware automatically. If that doesn't happen, try resetting the chip again until it works.
If you're getting a No response received (or similar) error, this means that:
- the power supply is too weak (read above)
- you're resetting the chip too quickly, i.e. you resetted it after the program started communicating with it
Flashing
The recommended tool to flash (or dump firmware) is ltchiptool.
Read Using ltchiptool to learn the flashing procedure
!!! tip Because the UART uploading code is programmed in the ROM of the chip, it can't be software-bricked, even if you damage the bootloader.
Firmware output files
These files are present in the build directory after successful compilation:
| File | Description |
|---|---|
| firmware.uf2 | UF2 package for UART and OTA upload |
| image_firmware.0x000000.bin | Full flash binary image - flashable at 0x0 |
| image_boot.0x000000.bin | Boot partition binary image - flashable at 0x0 |
| image_part_tab.0x006000.bin | Partition table binary image - flashable at 0x6000 |
| image_app.0x007000.bin | Application partition binary image - flashable at 0x7000 |
| image_ota.0x133000.bin | OTA partition binary image - flashable at 0x133000 |
Other tools/guides
-
Official command-line flashing tool
Usage Examples:
LN882H_CMD_Tool.exe COM1 download flash 921600 0x0 image_firmware.0x000000.bin
LN882H_CMD_Tool.exe COM1 download flash 921600 0x7000 image_app.0x007000.bin