libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
401 stars 59 forks source link

Support for bk7238 #265

Closed arikon closed 6 months ago

arikon commented 6 months ago

Is it possible to use ltchiptool with bk7238 SoC?

I tried with no luck on macOS:

% ltchiptool flash read --device /dev/cu.wchusbserial110 bk7231n bk7238-entire-flash.bin
I: Connecting to 'Beken 7231N' on /dev/cu.wchusbserial110 @ 115200
I: Connect UART1 of the BK7231 to the USB-TTL adapter:
I:
I:     --------+        +--------------------
I:          PC |        | BK7231
I:     --------+        +--------------------
I:          RX | ------ | TX1 (GPIO11 / P11)
I:          TX | ------ | RX1 (GPIO10 / P10)
I:             |        |
I:         GND | ------ | GND
I:     --------+        +--------------------
I:
I: Using a good, stable 3.3V power supply is crucial. Most flashing issues
I: are caused by either voltage drops during intensive flash operations,
I: or bad/loose wires.
I:
I: The UART adapter's 3.3V power regulator is usually not enough. Instead,
I: a regulated bench power supply, or a linear 1117-type regulator is recommended.
I:
I: To enter download mode, the chip has to be rebooted while the flashing program
I: is trying to establish communication.
I: In order to do that, you need to bridge CEN pin to GND with a wire.
E: TimeoutError: Timed out attempting to link with chip
E: |-- File "/Users/arikon/projects/firefly/beken_freertos_sdk-3.0.70/tools/matter_factory_data_generate/.python-venv/lib/python3.12/site-packages/bk7231tools/serial/__init__.py", line 42, in connect
arikon commented 6 months ago

When I connect CEN to GND for short time, I receive these errors

% ltchiptool flash read --device /dev/cu.wchusbserial110 bk7231n bk7238-entire-flash.bin
I: Connecting to 'Beken 7231N' on /dev/cu.wchusbserial110 @ 115200
I: Connect UART1 of the BK7231 to the USB-TTL adapter:
I:
I:     --------+        +--------------------
I:          PC |        | BK7231
I:     --------+        +--------------------
I:          RX | ------ | TX1 (GPIO11 / P11)
I:          TX | ------ | RX1 (GPIO10 / P10)
I:             |        |
I:         GND | ------ | GND
I:     --------+        +--------------------
I:
I: Using a good, stable 3.3V power supply is crucial. Most flashing issues
I: are caused by either voltage drops during intensive flash operations,
I: or bad/loose wires.
I:
I: The UART adapter's 3.3V power regulator is usually not enough. Instead,
I: a regulated bench power supply, or a linear 1117-type regulator is recommended.
I:
I: To enter download mode, the chip has to be rebooted while the flashing program
I: is trying to establish communication.
I: In order to do that, you need to bridge CEN pin to GND with a wire.
I: |-- Success! Chip info: None
I: Reading Flash (2 MiB) to 'bk7238-entire-flash.bin'
  [----------------------------------------------------------------]    1%  00:03:03
E: ValueError: Chip CRC value 9D4F91DB does not match calculated CRC value 928C04C6 (at 0x0)
E: |-- File "/Users/arikon/projects/firefly/beken_freertos_sdk-3.0.70/tools/matter_factory_data_generate/.python-venv/lib/python3.12/site-packages/ltchiptool/soc/bk72xx/flash.py", line 234, in flash_read_raw
arikon commented 6 months ago

https://github.com/tuya-cloudcutter/bk7231tools/issues/23

kuba2k2 commented 6 months ago

Continuing in the issue linked above.