micropython / micropython/micropython
ESP32 execute esp.read_flash() cause exception
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 22.1k
- Forks
- 9k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 16
Description
-
firmware version: MicroPython v1.13-106-g893f75546-dirty on 2020-10-16
-
customize partition table:
name type sub-type offset size nvs data nvs 0x9000 0x6000 phy_init data phy 0xf000 0x1000 factory app factory 0x10000 0x180000 vfs data fat 0x200000 0x1ff000 user_data data fat 0x3ff000 0x1000 -
executed code:
>>> import esp32 >>> part=esp32.Partition >>> part.find(type=part.TYPE_DATA) [<Partition type=1, subtype=2, address=36864, size=24576, label=nvs, encrypted=0>, <Partition type=1, subtype=1, address=61440, size=4096, label=phy_init, encrypted=0>, <Partition type=1, subtype=129, address=2097152, size=2093056, label=vfs, encrypted=0>, <Partition type=1, subtype=129, address=4190208, size=4096, label=user_data, encrypted=0>] >>> user=part("user_data") >>> user.info() (1, 129, 4190208, 4096, 'user_data', False) >>> >>> >> import esp >>> esp.flash_size() 4194304 >>> esp.flash_write(0x3ff000, b'walkline') >>> esp.flash_read(0x3ff000, 0x10) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: object with buffer protocol required >>>
According to the doc, the 2nd param is a length of buffer that I want to read, but why it raise a TypeError to me?
BTW, are there anyone knows how to use esp32.Partition to read and write blocks?
Thanks~
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the documented esp.flash_read API and reproduce the shown call, then compare its expected buffer argument with the behavior reported here. Also review the esp32.Partition entry point for the requested block read and write use case. Done means the API behavior and supported call shape are clear and consistent with the documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100