logo elektroda
logo elektroda
X
logo elektroda

ESP32 Wrover - Error when uploading code, no connection to chip. What to do?

ananasek12 447 6
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21295077
    ananasek12
    Level 2  
    good day.
    I need help uploading the code on the esp32 wrover, because every time I upload the code, it pops up something like this.
    Sketch uses 276669 bytes (21%) of program storage space. Maximum is 1310720 bytes.
    Global variables use 20288 bytes (6%) of dynamic memory, leaving 307392 bytes for local variables. Maximum is 327680 bytes.
    esptool.py v4.6
    Serial port COM3
    Connecting....Traceback (most recent call last):
    File "esptool.py", line 37, in <module>.
    File "esptool__init__.py", line 1064, in _main
    File "esptool__init__.py", line 859, in main
    File "esptoolcmds.py", line 466, in write_flash
    File "esptoolutil.py", line 37, in flash_size_bytes
    TypeError: argument of type 'NoneType' is not iterable

    Chip is ESP32-D0WDQ6 (revision v1.0)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    Crystal is 40MHz
    MAC: 08:b6:1f:8e:60:30
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 921600
    Changed.
    WARNING: Failed to communicate with the flash chip, read/write operations will fail. Try checking the chip connections or removing any other hardware connected to IOs.
    Configuring flash size...
    [24748] Failed to execute script 'esptool' due to unhandled exception!
    Failed uploading: uploading error: exit status 1

    but when I hold down rst, it goes something like this

    Sketch uses 276669 bytes (21%) of program storage space. Maximum is 1310720 bytes.
    Global variables use 20288 bytes (6%) of dynamic memory, leaving 307392 bytes for local variables. Maximum is 327680 bytes.
    esptool.py v4.6
    Serial port COM3
    Connecting......................................

    A fatal error occurred: Failed to connect to ESP32: No serial data received.
    For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
    Failed uploading: uploading error: exit status 2

    anticipating questions, I have already installed the CH340 driver, added esp32 wrover as the microcontroller I am uploading the code to and added the url (https://dl.espressif.com/dl/package_esp32_index.json).
    please reply quickly

    Quote:
    AI: What operating system are you using to upload code to the ESP32 Wrover?
    .
    windows11

    Quote:
    AI: Which development environment do you use (e.g. Arduino IDE, PlatformIO)?

    arduino ide
  • ADVERTISEMENT
  • #2 21295080
    lopr_pol
    Level 32  
    Try uploading on a slower port speed, com port sure it matches?
  • ADVERTISEMENT
  • #3 21295111
    ananasek12
    Level 2  
    I forgot to add I already tried a different speed and the com port is definitely good
  • ADVERTISEMENT
  • #4 21295416
    xury
    Automation specialist
    With some boards it sometimes happens that the auto flash mode does not work and you have to help by a manual sequence, i.e. hold down boot and press reset.
  • #5 21296126
    michal.zd
    Level 29  
    ananasek12 wrote:
    File "esptoolutil.py", line 37, in flash_size_bytes
    TypeError: argument of type 'NoneType' is not iterable
    .
    Looks like it's entering programming mode, just something missing from the esptool program.
    Maybe a bot will help?
    @ElektrodaBot
    During programming process ESP32 error:
    File "esptoolutil.py", line 37, in flash_size_bytes
    TypeError: argument of type 'NoneType' is not iterable
  • #6 21296127
    ElektrodaBot
    AI OpenAI ChatGPT4
    michal.zd wrote:
    During the ESP32 programming process, error:
    File "esptoolutil.py", line 37, in flash_size_bytes
    TypeError: argument of type 'NoneType' is not iterable
    Preliminary evaluation of available information .

    - Analysis of the data provided by the user: .
    - User encounters an error while programming the ESP32 module:
    Code: Text
    Log in, to see the code
    .
    - Identification of missing information: .
    - Exact ESP32 model (e.g. ESP32-WROOM-32, ESP32-C3, etc.).
    - Development environment used (Arduino IDE, PlatformIO, ESP-IDF)
    - Version of `esptool.py` and Python tool
    - Computer operating system (Windows, macOS, Linux)
    - Connection configuration details (COM port, connection settings)
    - Full content of the error message (whether there is additional information before or after the given line)

    Direct answer to question

    The error `TypeError: argument of type 'NoneType' is not iterable` in the `esptoolutil.py` file, line 37, indicates a problem with the `esptool.py` utility reading the Flash memory size of the ESP32 module. This may be due to hardware problems, incorrect environment configuration or use of an incompatible module.

    Key points: .

    - Check the hardware connections and ensure that no additional devices are connected to the module to interfere with communication.
    - Make sure you are using the correct ESP32 model with built-in Flash memory.
    - Update your development tools, in particular `esptool.py`, to the latest version.

    Detailed analysis of the problem .

    Possible causes of the error: .

    1. Hardware problems:

    - Shorts or interference on I/O pins: .
    - Connected devices or sensors may interfere with communication with the Flash memory.
    - It is recommended to disconnect all additional components and leave only the basic ESP32 connection to the computer.

    - Insufficient power supply: .
    - The ESP32 may require a stable power supply, especially during programming.
    - Make sure the USB port provides sufficient current or use an external power source.

    2. Incompatible or faulty ESP32 module: .

    - Lack of built-in Flash memory: .
    - Some versions of the ESP32-C3 do not have built-in Flash memory and require external SPI Flash memory.
    - Check the chip model and its technical specification.

    - Physical damage to the module: .
    - Physical damage may affect the operation of the Flash memory.
    - Check the module for visible damage.

    3. Software problems: .

    - Updated tools: .
    - Older versions of `esptool.py` may not support newer ESP32 models or have known bugs.
    - It is recommended to update `esptool.py` to the latest version.

    - Incorrect environment configuration: .
    - Incorrect settings can lead to problems during programming.
    - Ensure that the environment is correctly configured for your module.

    Recommended troubleshooting steps:

    1. Update tools and drivers: .

    - Update `esptool.py`: .
    Code: text
    Log in, to see the code
    .
    - Check Python version: .
    - Make sure you are using Python 3.x, as some functions may not work properly in Python 2.x.

    2. Verify the ESP32 model: .

    - Check module specification: .
    - Make sure the module has built-in flash memory.
    - If you are using ESP32-C3, make sure it is the version with built-in memory.

    3. Check hardware connections: .

    - Disconnect all additional devices: .
    - During programming, the module should only be connected to the computer.
    - Check USB cable: .
    - Use a tested USB cable with data transfer function.

    4. Configure the development environment: .

    - Select the appropriate board model in the IDE: .
    - In the Arduino IDE or other environment, set the correct board type and parameters.
    - Check Flash memory settings: .
    - Manually configure Flash memory size if automatic detection fails.

    5. Diagnose the problem via logs: .

    - Start tool with enhanced detail option: .
    Code: text
    Log in, to see the code
    .
    - Analyse detailed logs: .
    - Additional information may indicate the exact location and cause of the error.

    6. Check permissions and access: .

    - On Unix/Linux systems: .
    - Make sure you have permission to access the serial port.
    - You may need to add a user to the `dialout` group or use the `sudo` command.

    7. Test on another computer or with another module: .

    - Exclude hardware or system problems: .
    - If possible, try programming the module on another computer.
    - Use another ESP32 module to see if the problem persists.

    . News and trends .

    - New ESP32 versions and compatibility: .
    - New variants of ESP32 modules have recently been released, such as the ESP32-S3, which may require updates to the tools to support them.
    - `esptool.py` is updated regularly to support new chips and to fix bugs.

    - Increased security and drivers: .
    - Some operating systems tighten security policies regarding access to serial ports.
    - Driver updates may be necessary, especially on the latest versions of operating systems.

    Supporting explanations and details

    - Function `flash_size_bytes`: .
    - Responsible for reading the size of the Flash memory from the module.
    - If it returns `None`, it means that it failed to read this information.

    - Error `TypeError` and `NoneType`: .
    - Occurs when code attempts to iterate or perform an operation on the value `None`.
    - Indicates missing data or an unexpected condition in the program.

    Practical tips .

    - Regular updates:
    - Keep your development tools and drivers in the latest versions.

    - Detailed documentation: .
    - Refer to the module manufacturer's documentation and development tools.

    - Minimise configuration: .
    - Maintain a minimal hardware configuration during troubleshooting.

    Possible caveats or additional comments .

    - Possible faulty module: .
    - If all attempts at repair fail, consider the possibility of a faulty ESP32 module.

    Suggestions for further research .

    - Consult the community: .
    - Visit specialist forums such as elektroda.co.uk to search for similar cases.

    - Up-to-date resources and documentation: .
    - Check out the latest information in the official Espressif documentation and current discussions in the communities.

    Short summary .

    The error indicates a problem with `esptool.py` reading the size of the Flash memory, which may be caused by hardware problems, incorrect configuration or an incompatible module. It is recommended to run a series of diagnostic steps to identify and resolve the problem.

    User queries .

    Please answer the following questions to better assist in solving your problem:

    1. What exact model of ESP32 module do you have? .
    - Is it an ESP32, ESP32-C3, ESP32-S3 or another variant?
    - Manufacturer name and possible model number.

    2. What development environment are you using? .
    - Arduino IDE, PlatformIO, ESP-IDF or other?
    - Version of software used.

    3. What operating system is installed on your computer?
    - Windows (version), macOS, Linux (distribution and version).

    4. Can you provide the full error message and the command or actions that lead to the error? .

    5. Are there any other devices or modules connected to the module during programming? .

    6. Have you tried to program another copy of the ESP32 module, if you have one? .

    Obtaining this information will allow you to diagnose more accurately and find an effective solution more quickly.
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • ADVERTISEMENT
  • #7 21296134
    michal.zd
    Level 29  
    Quote:
    Error `TypeError: argument of type 'NoneType' is not iterable` in file `esptoolutil.py`, line 37, indicates a problem with the `esptool.py` utility reading the ESP32 module's Flash memory size. This may be due to hardware problems, incorrect environment configuration or use of an incompatible module.

    I also think this is the cause. Not coincidentally, the function is named flash_size_bytes.
    So:
    Check the Flash memory settings:
    - Manually configure the Flash memory size if automatic detection fails.

Topic summary

The ESP32 Wrover module encounters a TypeError during code upload, specifically in esptoolutil.py at the flash_size_bytes function, indicating a failure to read the flash memory size. The error message "argument of type 'NoneType' is not iterable" suggests that esptool.py cannot detect the flash size automatically. Attempts to change the COM port speed and verify the port were unsuccessful. A recommended workaround includes manually entering the ESP32 programming mode by holding the BOOT button and pressing RESET during upload. Additionally, manually specifying the flash memory size in the esptool or development environment settings may resolve the issue. Further details such as the exact ESP32 model variant, development environment, esptool.py version, and operating system were not provided but are relevant for troubleshooting.
Summary generated by the language model.
ADVERTISEMENT