Skip to content

Commit

Permalink
mainly to add burn firmware way
Browse files Browse the repository at this point in the history
  • Loading branch information
xiemeiping committed Oct 13, 2022
1 parent 0a0d5a3 commit f4b40c1
Show file tree
Hide file tree
Showing 30 changed files with 225 additions and 101 deletions.
27 changes: 27 additions & 0 deletions docs/source/conf.py
Expand Up @@ -609,3 +609,30 @@
"""


# open link in a new window

rst_epilog += """
.. |link_micropython| raw:: html
<a href="https://en.wikipedia.org/wiki/MicroPython" target="_blank">MicroPython - Wikipedia</a>
.. |link_thonny| raw:: html
<a href="https://thonny.org/" target="_blank">Thonny</a>
.. |link_sunfounder_controller| raw:: html
<a href="https://docs.sunfounder.com/projects/sf-controller/en/latest/" target="_blank">SunFounder Control</a>
.. |link_realpython| raw:: html
<a href="https://realpython.com/micropython/" target="_blank">realpython</a>
.. |link_micropython_pi| raw:: html
<a href="https://www.raspberrypi.com/documentation/microcontrollers/micropython.html#drag-and-drop-micropython" target="_blank">method</a>
"""
5 changes: 5 additions & 0 deletions docs/source/espproject/esp_basic_function.rst
@@ -1,3 +1,5 @@
.. _first_time_use:

1.1 First-time Use the APP
==============================

Expand All @@ -23,6 +25,9 @@ This section will guide you to complete the communication between Sunfounder Con

After running the program, you will see the IP address and the "start" prompt in the Shell.

.. note::
If the wiring is OK, but still no successful connection prompt after several runs, the firmware of ESP8266 module may need to be re-burned, please refer to :ref:`burn_firmware` for details.

|sc_run_test|

#. Connect to ESP8266.
Expand Down
125 changes: 122 additions & 3 deletions docs/source/faq.rst
Expand Up @@ -21,7 +21,7 @@ MicroPython

#. NO MicroPython(Raspberry Pi Pico) Interpreter Option on Thonny IDE?
* Check that your Pico is plugged into your computer via a USB cable.
* Check that you have installed MicroPython for Pico (:ref:`setup_pico_micropython`).
* Check that you have installed MicroPython for Pico (:ref:`install_micropython_on_pico`).
* The Raspberry Pi Pico interpreter is only available in version 3.3.3 or higher version of Thonny. If you are running an older version, please update (:ref:`thonny_ide`).
* Plug in/out the micro USB cable sveral times.

Expand All @@ -32,7 +32,7 @@ MicroPython
#. Can Raspberry Pi Pico be used on Thonny and Arduino at the same time?
NO, you need to do some different operations.

* If you used it on Arduino first, and now you want to use it on Thonny IDE, you need to :ref:`setup_pico_micropython` on it.
* If you used it on Arduino first, and now you want to use it on Thonny IDE, you need to :ref:`install_micropython_on_pico` on it.
* If you used it on Thonny first, and now you want to use it on Arduino IDE, you need to :ref:`setup_pico_arduino`.


Expand Down Expand Up @@ -79,4 +79,123 @@ Piper Make
For detailed tutorials, please refer to :ref:`per_save_import`.

#. How to connect to Pico?
For detailed tutorials, please refer to :ref:`connect_pico_per`.
For detailed tutorials, please refer to :ref:`connect_pico_per`.



.. _burn_firmware:

How to re-burn the firmware for ESP8266 module?
-----------------------------------------------------

**1. Download firmwre and burn-in tool**

* :download:`ESP8266 Firmware <https://github.com/sunfounder/euler-kit/raw/main/esp8266/esp8266%20firmware.zip>`

After unzipping, you will see 3 files.

.. image:: img/bat_firmware.png

* ``esp8266-uart-wsserver-v1.0.2.bin``: The firmware to burn to the ESP8266 module.
* ``esptool.exe``: This is a command-line utility for Windows.
* ``install.bat``: This is the command package for Windows system, double click this file will run all the commands inside the file.
* ``picoprobe.uf2``: This file allows a Pico to act as a USB → SWD and UART converter.

**2. Set Pico as a USB → SWD and UART converter**

#. Hold down the **BOOTSEL** button and connect the Pico to your computer with a Micro USB cable.

|mps_bootsel_onboard|

#. Once your Pico is mounted as a Mass Storage Device called RPI-RP2, release the **BOOTSEL** button.

.. image:: img/rpi_rp2.png

#. Go to the Downloads folder and find the file you just downloaded, then drag ``picoprobe.uf2`` to the RPI-RP2 storage drive.

|mps_move_uf2|

#. The Pico will reboot and disappear from the File Manager, then Pico's USB will be recognized as a serial port and you can see it in the **Device Manager**.

.. image:: img/com_port.png

**3. Build the circuit**

Connect ESP8266 module and Raspberry Pi Pico.

.. image:: img/esp8266_firmware.png
:width: 800

**4. Burn the firmware**

* Follow the steps below to burn the firmware if you are using **Windows**.

#. Double click ``install.bat`` to start the firmware burning. If you see the following prompt, the firmware has been installed successfully.

.. image:: img/burn_firmware.png

.. note::
If the burn-in fails, please check the following points.

* If it does not work the first time, close the window and double click ``install.bat``.
* Reset the ESP8266 module by inserting the RST to GND and then unplugging it.
* Check if the wiring is correct.
* Make sure the port is not occupied.

* To burn the firmware, follow these steps if you are using a **Mac OS** system.

#. Use the following commands to install Esptool. Esptool is a Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips.

.. code-block::
python3 -m pip install --upgrade pip
python3 -m pip install esptool
#. If esptool is properly installed, it will output a message such as [usage: esptool] if you run ``python3 -m esptool``.

#. Open a terminal and use the ``cd`` command to go into the firmware folder you just downloaded, then run the following command to erase the existing firmware and re-burn the new firmware.

.. code-block::
esptool.exe --chip esp8266 --before no_reset_no_sync erase_flash
esptool.exe --chip esp8266 --before no_reset_no_sync write_flash 0 "esp8266-uart-wsserver-v1.0.2.bin"
#. If you get the prompt message like this, the firmware is burned successfully.

.. image:: img/burn_firmware.png

.. note::
If the burn-in fails, please check the following points.

* If it does not work the first time, close the window and double click ``install.bat``.
* Reset the ESP8266 module by inserting the RST to GND and then unplugging it.
* Check if the wiring is correct.
* Make sure the port is not occupied.

**5. Test after burning firmware**

.. note::
* If you confirm that the firmware has been burned successfully and you don't want to test it again, you can also go ahead and finish the project - :ref:`first_time_use`.
* The Raspberry Pi Pico here uses the serial firmware, you need to :ref:`install_micropython_on_pico` before you can run the MicroPython script.

#. On the basis of the original wiring, leave **IO0** and **RST** hanging.

.. image:: img/esp8266_firmware_test.png

#. As Thonny doesn't come with a serial port tool, you'll need to use the Arduino IDE's serial monitor or another serial port tool to test it. The Arduino IDE 2.0 will be used here, open it and select the port. Note that your port is different from mine.

.. image:: img/com16.png

#. Click on the Serial Monitor icon to open it and select the display mode (New line) and baud rate (115200 baud).

.. image:: img/faq_serial_monitor.png

#. Type ``SET+RESET``, and press ``Ctrl+Enter`` to send this command. Once the firmware has been burned successfully, you will see a string of characters + OK.

.. image:: img/faq_return_ok.png

#. At this point you can go ahead and finish the project - :ref:`first_time_use`.

.. note::

* The Raspberry Pi Pico here uses the serial firmware, you need to :ref:`install_micropython_on_pico` before you can run the MicroPython script.
Binary file added docs/source/img/bat_firmware.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/burn_firmware.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/com16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/com_port.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/esp8266_firmware.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/esp8266_firmware_test.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/faq_return_ok.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/img/faq_serial_monitor.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 0 additions & 42 deletions docs/source/piperproject/2.12_overcrowd.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/pyproject/for_micropython_user.rst
Expand Up @@ -10,8 +10,8 @@ We recommend that you read the chapters in order.
:maxdepth: 1

python_start/introduction_micropython
python_start/setup_pico
python_start/thonny_python_ide
python_start/install_micropython_pico
python_start/download_add
python_start/quick_guide_thonny
python_start/syntax/micropython_basic_syntax
Expand Down
28 changes: 14 additions & 14 deletions docs/source/pyproject/python_start/download_add.rst
Expand Up @@ -18,30 +18,30 @@ Download the relevant code from the link below.
Upload the Libraries to Pico
----------------------------------

In some projects, you will need additional libraries. So here we upload these libraries to Raspberry Pi Pico first, and then we can run the code directly later.
#. In some projects, you will need additional libraries. So here we upload these libraries to Raspberry Pi Pico first, and then we can run the code directly later.

Click **View** -> **Files** in the top navigation bar of Thonny IDE.
#. Click **View** -> **Files** in the top navigation bar of Thonny IDE.

|mps_th_files|
|mps_th_files|

Go to the folder where you downloaded the `code package <https://github.com/sunfounder/euler-kit/archive/refs/heads/main.zip>`_ before, and then go to the ``micropython/`` folder.
#. Go to the folder where you downloaded the `code package <https://github.com/sunfounder/euler-kit/archive/refs/heads/main.zip>`_ before, and then go to the ``micropython/`` folder.

|mps_th_path|
|mps_th_path|

Select "MicroPython (Raspberry Pi Pico)" from the interpreter selection button in the bottom right corner, but make sure that your Raspberry Pi Pico is connected to your computer via a Micro USB cable.
#. Select "MicroPython (Raspberry Pi Pico)" from the interpreter selection button in the bottom right corner, but make sure that your Raspberry Pi Pico is connected to your computer via a Micro USB cable.

|mps_interpreter|
|mps_interpreter|

The drive **Raspberry Pi Pico/** will appear, and the next step is to upload all the code and library files to it.
#. The drive **Raspberry Pi Pico/** will appear, and the next step is to upload all the code and library files to it.

|mps_th_pico|
|mps_th_pico|

Each project has its own **.py** file with serial numbers. To avoid increasing Pico's usage, only select ``.py`` files and folders without serial numbers.
#. Each project has its own **.py** file with serial numbers. To avoid increasing Pico's usage, only select ``.py`` files and folders without serial numbers.

It will take a while for the file to upload after clicking **Upload to**.
#. It will take a while for the file to upload after clicking **Upload to**.

|mps_th_upload|
|mps_th_upload|

Now you will see the files you just uploaded inside your drive ``Raspberry Pi Pico``.
#. Now you will see the files you just uploaded inside your drive ``Raspberry Pi Pico``.

|mps_th_done|
|mps_th_done|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/source/pyproject/python_start/install_micropython_pico.rst
@@ -0,0 +1,36 @@
.. _install_micropython_on_pico:

1.3 Install MicroPython Firmware on Your Pico
=========================================================


Now come to install MicroPython Firmware into Raspberry Pi Pico, Thonny IDE provides a very convenient way for you to install it with one click.

.. note::
If you do not wish to upgrade Thonny, you can use the Raspberry Pi official |link_micropython_pi| by dragging and dropping an ``rp2_pico_xxxx.uf2`` file into Raspberry Pi Pico.

#. Open Thonny IDE.

.. image:: img/set_pico1.png

#. Press and hold the **BOOTSEL** button and then connect the Pico to computer via a Micro USB cable. Release the **BOOTSEL** button after your Pico is mount as a Mass Storage Device called **RPI-RP2**.

.. image:: img/bootsel_onboard.png

#. In the bottom right corner, click the interpreter selection button and select **Install Micropython**.

.. note::
If your Thonny does not have this option, please update to the latest version.

.. image:: img/set_pico2.png

#. In the **Target volume**, the volume of the Pico you just plugged in will automatically appear, and in the **Micropython variant**, select **Raspberry Pi.Pico/Pico H**.

.. image:: img/set_pico3.png

#. Click the **Install** button, wait for the installation to complete and then close this page.

.. image:: img/set_pico4.png


Congratulations, now your Raspberry Pi Pico is ready to go.
38 changes: 0 additions & 38 deletions docs/source/pyproject/python_start/setup_pico.rst

This file was deleted.

0 comments on commit f4b40c1

Please sign in to comment.