Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroPython on the ESP32-D2WD (2MiB) #4986

Closed
zrecore opened this issue Aug 7, 2019 · 18 comments

Comments

@zrecore
Copy link
Contributor

commented Aug 7, 2019

In case anyone else is interested, I've managed to mod the source and a partitions.csv file to get MicroPython and its filesystem working on an ESP32-D2WD, which only as 2MiB of internal Flash, not 4MiB.

Modded ports/esp32/modules/flashbdev.py, ports/esp32/modesp.c, and ports/esp32/partitions.csv
Screenshot from 2019-08-07 03-15-20
Screenshot from 2019-08-07 03-15-33
Screenshot from 2019-08-07 03-16-09

I would recommend we not hard-code things to 0x200000 anymore, as Espressif offers 2MiB internal SPI flash chips. Perhaps we rework these changes a bit to make the built process account for flash user start addresses lower than 0x200000?

@nevercast

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

Nice one!

I agree that constants hurt. I'm starting to think it's becoming more and more preferable to have board configs for ESP32. We can still use sdkconfig if we make the ESP32 port an ESP IDF component and use the KConfig system.

Then once we have a good place for them we can start moving this constants out to various configs.

@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2019

See pull request #4987

@tcpipchip

This comment has been minimized.

Copy link

commented Aug 9, 2019

I followed the process, but my NINA W102 (2MB flash) is resetting!
Can you inform me where address to burn those 3 bin files created ? (application, partition and bootloader) if i use flash tools ?

@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Aug 9, 2019

I followed the process, but my NINA W102 (2MB flash) is resetting!
Can you inform me where address to burn those 3 bin files created ? (application, partition and bootloader) if i use flash tools ?

@tcpipchip when make is run, firmware.bin will be generated. Please see the following instructions.

With the changes shown in the PR, you will need to set the env variables.

Go into the /ports/esp32 folder.
(Replace /dev/ttyUSB0 with your actual port.)

if using a makefile which imports Makefile... adjust/add the following

PORT = /dev/ttyUSB0
FLASH_MODE = dio
FLASH_FREQ = 40m
## if using a 2MiB ESP32 board
FLASH_SIZE = 2MB
FLASH_USER_START = 0x120000 # Defaults to 0x200000 address if not provided
FLASH_STORAGE_PARTITION_SIZE = 0xA0000 # 640MiB max. Defaults to 0x200000 if not provided (2MiB partition on 4MiB Flash ESP32 boards)
PART_SRC = partitions-2MiB.csv # Use the custom partitions CSV for 2MiB devices

or .envrc if using direnv

# .envrc file

export ESPIDF="$HOME/esp-idf"
export FLASH_SIZE="2MB"
export FLASH_MODE="dio"
export FLASH_FREQ="40m"
export FLASH_USER_START=0x120000
export FLASH_STORAGE_PARTITION_SIZE=0xA0000
export PART_SRC="partitions-2MiB.csv"

Run make clean then make

Before flashing, erase the flash, then flash the firmware.

esptool.py -p /dev/ttyUSB0 erase_flash
esptool.py -p /dev/ttyUSB0 write_flash -z 0x1000 build/firmware.bin
@tcpipchip

This comment has been minimized.

Copy link

commented Aug 9, 2019

Thanks to the feedback @zrecore

And those 3 files
ports/esp32/modules/flashbdev.py, ports/esp32/modesp.c, and ports/esp32/partitions.csv

Still Need to modify too ?

@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Aug 9, 2019

Thanks to the feedback @zrecore

And those 3 files
ports/esp32/modules/flashbdev.py, ports/esp32/modesp.c, and ports/esp32/partitions.csv

Still Need to modify too ?

@tcpipchip You can see all file changes in the Pull Request, see https://github.com/micropython/micropython/pull/4987/files

@tcpipchip

This comment has been minimized.

Copy link

commented Aug 10, 2019

Good Morning!!!!

Now NINA W102 is running Micropython!!!! Thanks @zrecore

You are the best!!!!!!!!!!!!!!!

Btw we ported the AT COMMANDS to 2Mb ESP32 too!

Did you do that too ?

image

@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Aug 10, 2019

@tcpipchip

This comment has been minimized.

Copy link

commented Aug 11, 2019

Zrecore

Using 2mb version.Did you have problems with MQTT with certifications ?

Looks that not works!

Mine is reseting when try to open the MQTT with certifications...

@tcpipchip

This comment has been minimized.

Copy link

commented Aug 11, 2019

image

@tcpipchip

This comment has been minimized.

Copy link

commented Aug 17, 2019

Hi, the behavior of your esp32 is going well using 2mb ? Mine is very strange, sometimes not boot, or not get wifi, or not open tcp sockets

@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Aug 17, 2019

@tcpipchip

This comment has been minimized.

Copy link

commented Aug 17, 2019

Yes! A lot of problems! I aborted to use it!

zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 23, 2019
…type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
…type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
…type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
Updating custom partitions CSV comments

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Implementing boards mpconfigboard files for generic ESP32-D2WD board type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Removing merge conflict junk leftovers

We no longer need some of the changes once we rebase off PR micropython#5027. FLASH_USER_START and FLASH_SIZE removed.
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
Updating custom partitions CSV comments

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Implementing boards mpconfigboard files for generic ESP32-D2WD board type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Removing merge conflict junk leftovers

We no longer need some of the changes once we rebase off PR micropython#5027. FLASH_USER_START and FLASH_SIZE removed.

No need for gitignore modifications

Removing left over edit to README

Rolling back changes to modesp, updating partitions-2MiB.csv to name storage partition as vfs
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
Updating custom partitions CSV comments

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Implementing boards mpconfigboard files for generic ESP32-D2WD board type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Removing merge conflict junk leftovers

We no longer need some of the changes once we rebase off PR micropython#5027. FLASH_USER_START and FLASH_SIZE removed.

No need for gitignore modifications

Removing left over edit to README

Rolling back changes to modesp, updating partitions-2MiB.csv to name storage partition as vfs

Undoing changes to gitignore
zrecore added a commit to femtoduino/micropython that referenced this issue Aug 24, 2019
Updating custom partitions CSV comments

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Adjusting partitions CSV for 2MiB ESP32 devices. Storage partition is now 0xA0000 (640KiB)

Implementing boards mpconfigboard files for generic ESP32-D2WD board type

Rebase off upstream master branch. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Git rebase off upstream master. Removing 404 link in comments

What is this, recursion? Attempting to rebase off upstream master. Again. Adding support for ESP32-D2WD (2MiB) for issue micropython#4986

Removing 404 link in comments

Removing merge conflict junk leftovers

We no longer need some of the changes once we rebase off PR micropython#5027. FLASH_USER_START and FLASH_SIZE removed.

No need for gitignore modifications

Removing left over edit to README

Rolling back changes to modesp, updating partitions-2MiB.csv to name storage partition as vfs

Undoing changes to gitignore

Renaming board config for generic ESP32-D2WD
@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Aug 24, 2019

@tcpipchip for every issue you find, would you mind documenting:

  • What happened
  • What you expected
  • How to reproduce the issue
dpgeorge added a commit that referenced this issue Sep 10, 2019
This patch adds a partitions file for the D2WD and a new board GENERIC_D2WD
which runs on these chip variants.

Resolves issue #4986.
@dpgeorge

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

The D2WD is now supported by the GENERIC_D2WD board, via commit 80d37d9

@dpgeorge dpgeorge closed this Sep 10, 2019
@dpgeorge dpgeorge added the port-esp32 label Sep 10, 2019
@tcpipchip

This comment has been minimized.

Copy link

commented Sep 10, 2019

i will try soon to see if solve the MQTT access with 3 certifications error

@tcpipchip

This comment has been minimized.

Copy link

commented Sep 10, 2019

with this patches now resets my NINA W102 (enter a reset loop)
can you inform me the correct sequence now to build micropython ?

I had followed this that worked good https://www.microdev.it/wp/en/2018/08/08/esp32-micropython-compiling-for-esp32/

@zrecore

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2019

@tcpipchip I'll do my best to help you, but please create a new GitHub issue for the problem.

UnexpectedMaker pushed a commit to UnexpectedMaker/micropython that referenced this issue Sep 25, 2019
This patch adds a partitions file for the D2WD and a new board GENERIC_D2WD
which runs on these chip variants.

Resolves issue micropython#4986.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.