← index #6553Issue #17663
Related · medium · value 1.270
QUERY · ISSUE

ESP32 execute esp.read_flash() cause exception

openby walklinewangopened 2020-10-16updated 2024-09-13
docsport-esp32
  • 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~

CANDIDATE · ISSUE

ESP32S3N16R8:Missing flash ORIGINALLY 16M , ACTUALLY 8M

closedby AZhi-hubopened 2025-07-11updated 2025-07-13
bug

Port, board and/or hardware

esp32s3N16R8 port

MicroPython version

MicroPython v1.25.0 on 2025-04-15; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3

<img width="1075" height="667" alt="Image" src="https://github.com/user-attachments/assets/3ee7bfa2-4046-4e5e-abd8-e6382d9e62a7" />

Reproduction

In according to official guidance , open powershell echo:
esptool --baud 460800 write_flash 0 .\ESP32_GENERIC_S3-SPIRAM_OCT-20250415-v1.25.0.bin
click RST button,and open thonny,execute

import esp
import gc
print(esp.flash_size())
print(esp.flash_user_start())
print(gc.mem_free())

you will find a problem like result below.

  • First line is flash size ,equals 8M,corresponds to rom
  • Second Line is user partition start,I know,ESP32_GENERIC_S3-SPIRAM_OCT-20250415-v1.25.0.bin is 1.5M , from 2M maybe reasonable.
  • Third Line is mem_free, corresponds to ram .
8388608
2097152
8320080

Actually my board is N16R8, means 16M psrom and 8M psram. after using Micropython bin, I got 8M rom , and 8M ram ,where is 8M left from flash?
I chose OCT version bin due to 8M psram, but normal and OCT version both miss flash size. I don't know why and how i need to do or it's something being limited.
And thonny is also 6m,maybe 8M-2M?

<img width="1427" height="700" alt="Image" src="https://github.com/user-attachments/assets/0b63906e-d976-478f-82e7-b166ddc521f8" />

Expected behaviour

get missed 8m flash size for using

Observed behaviour

like above.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied