Based on HiFlying HF-LPX70 SDK.
The main purpose is to bypass BL602 chip in HiFlying Elfin EG41B device. This makes Air780e direct access via UART1 to main EG41B RS232/RS485 out port.
- Clone this repo:
git clone https://github.com/freshev/BL602-UART-bridge-
Install MSYS2
-
Add MSYS2 \usr\bin to PATH environment variable like
C:\msys64\usr\bin -
Run one of the following
makeXXX.bat
make_9600_7E1.bat
make_9600_8N1.bat
make_115200_7E1.bat
make_115200_8N1.batI.e. make_9600_7E1.bat makes a binary firmware for UART 0 to 1 bridge with baudrate 9600, 7-Even-1, etc.
Burn with SimpleFlasher:
- Execute
BLDevCube\BLDevCube.exe
- Select
Partition tableto.\chips\bl602\partition\partition_cfg_HF_2M_V2.0.01.toml - Select
Boot2 Binto.\chips\bl602\bootloader_HF_2M_V3.0.12.bin - Select
Firmware Binto..\out\lpt570_full_9600_8N1.bin
-
Connect Elfin EG41B to PC via USB/RS232/RS485 converter. Wires from USB/RS232/RS485 converter to EG41B board MUST be short (not more then 5cm). Otherwise, you will get errors/unstables when reading/writing flash.
-
Connect GPIO8 via a 5-10kOhm resistor to 3.3V (copper pads on the back of the EG41B board).
-
Turn power (off and) on to EG41B board.
-
Start burn, pressing
Create and Downloadbutton. -
Break GPIO8 connection to 3.3v.
-
Turn power off and on.
To test bridge:
- Connect to Air780e (USB-C jack at EG41B board)
- Open terminal on appeared new third (or second) COM port.
- in Air780e micropython mode use following script:
from machine import UART
import time
u = UART(1, 9600)
while(True):
if u.any() > 0:
r = u.read()
if r is not None and len(r) > 0:
print(r.decode(), end = '')
u.write(r)
time.sleep_ms(10)- Symbols from BL602 UART0 (main EG41B input) should be printed in micropython and returned back to UART0.
- The new designed
BLEDebugapplication can show debug output from BLE602 chip (Debug over Bluetooth). See BLEDebug folder. - Default lib
LPBX7Kernelwas rewritten to redirect chip debug log to Bluetooth. Also changes made in some project.mkfiles. - To make sure the firmware is working - compile and burn the firmware with
hfdbg_set_level(1)at src/app_main.c. In this case you should see[UART](with garbage) message at EG41B main port (PC USB/RS232/RS485 converter configured with 115200, 8N1). - To completely disable debug log compile and burn the firmware with
hfdbg_set_level(0)at src/app_main.c - BL602 GPIO21 connected to Air780 power.
- BL602 GPIO12 connected to Air780 reset.
- BL602 GPIO16 connected to internal EG41B UART/RS485 converter (DE/!RE pin).
- FreeRTOS Kernel V10.2.1 Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- HiFlying HF-LPX70 SDK Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd.
- BLEDebug screenshot