e-puck2 radio module development: Difference between revisions

From GCtronic wiki
Jump to navigation Jump to search
(Created page with "==Flashing the radio module== In order to update the firmware of the ESP32 WiFi module you need to use a python script called <code>esptool</code> provided by Espressif (manuf...")
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Flashing the radio module==
[{{fullurl:e-puck2}} e-puck2 main wiki]<br/>
In order to update the firmware of the ESP32 WiFi module you need to use a python script called <code>esptool</code> provided by Espressif (manufacturer of the chip). This script was modified to work with the e-puck2 robot and is available from the following link:
* Windows: [http://projects.gctronic.com/epuck2/esptool.exe esptool.exe]; Python not required on the system.
* Linux/Mac: [http://projects.gctronic.com/epuck2/esptool.py esptool.py]; Python 3.4 and pySerial 2.5 need to be installed on the system.
Place the script in the same folder as the firmware (composed by 3 bin files: <code>bootloader.bin</code>, <code>ESP32_E-Puck_2.bin</code> and <code>partitions_singleapp.bin</code>) and then issue the following command:
* Windows:
<pre>esptool.exe --chip esp32 --port COM96 --baud 230400 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x10000 ESP32_E-Puck_2.bin 0x8000 partitions_singleapp.bin</pre>
Alternatively you can download the following batch file [http://projects.gctronic.com/epuck2/esp32-flashing.bat esp32-flashing.bat]
*Linux/Mac:
<pre>python esptool.py --chip esp32 --port COM96 --baud 230400 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x10000 ESP32_E-Puck_2.bin 0x8000 partitions_singleapp.bin</pre>
In all cases you need to specify the correct port (with <code>--port</code> parameter) that is the one labeled <code>Serial monitor</code> (see chapter [http://www.gctronic.com/doc/index.php?title=e-puck2#Finding_the_USB_serial_ports_used Finding the USB serial ports used]).


The upload should last about 10-15 seconds and you'll see the progress as shown in the following figure:<br/>
=Introduction=
<span class="plain links">[http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing1.png <img width=400 src="http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing1.png">]</span><br/>
Espressif provides the [https://github.com/espressif/esp-idf Espressif IoT Development Framework] (ESP-IDF for short), that is a framework for developing applications based on the Espressif ESP32 chip. The firmwares developed for the e-puck2 radio module are based on this framework.<br/>
When the upload is complete you'll see that all 3 bin files are uploaded correctly as shown in the following figure:<br/>
The software development framework provided by Espressif is intended for rapidly developing Internet of Things (IoT) applications, with Wi-Fi, Bluetooth, flexible power management and other advanced system features.<br/>
<span class="plain links">[http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing2.png <img width=400 src="http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing2.png">]</span><br/>
Users can develop applications in Windows, Linux and MacOS based on ESP-IDF.<br/>
The <code>C programming</code> language is used to develop code for the radio module of the e-puck2 robot and the ESP-IDF includes the FreeRTOS real time operating system.


Sometime you could encounter a timeout error as shown in the following figures; in these cases you need to unplug and plug again the USB cable and power cycle the robot, then you can retry.<br/>
=Development environment=
<span class="plain links">[http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing3.png <img width=400 src="http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing3.png">]</span>
In order to build the firmware you need to install the toolchain, refer to [http://esp-idf.readthedocs.io/en/latest/get-started/#setup-toolchain http://esp-idf.readthedocs.io/en/latest/get-started/#setup-toolchain].<br/>
<span class="plain links">[http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing4.png <img width=400 src="http://projects.gctronic.com/epuck2/wiki_images/esp32-flashing4.png">]</span><br/>
Once installed you can issue the command <code>make flash</code> from the directory <code>Projects\ESP32_E-Puck_2</code> to build the firmware.<br/>
For more information have a look at [http://esp-idf.readthedocs.io/en/latest/get-started/#build-and-flash http://esp-idf.readthedocs.io/en/latest/get-started/#build-and-flash].<br/>
==Debugging==
You can debug your code by printing some information on the serial port, then from the PC you can read these information by opening the <code>Serial Monitor</code> port (have a look at the chapter [https://www.gctronic.com/doc/index.php?title=e-puck2#Finding_the_USB_serial_ports_used Finding the USB serial ports used] to know what ports are availables).
 
=Get the source code=
The radio module firmware source code can be downloaded with the command:<br/>
<code>git clone --recursive https://github.com/e-puck2/esp-idf.git</code><br/>
 
==WiFi==
The radio module wifi firmware source code can be downloaded with the command:<br/>
<code>git clone -b wifi --recursive https://github.com/e-puck2/esp-idf.git</code><br/>

Revision as of 07:10, 15 November 2019

e-puck2 main wiki

Introduction

Espressif provides the Espressif IoT Development Framework (ESP-IDF for short), that is a framework for developing applications based on the Espressif ESP32 chip. The firmwares developed for the e-puck2 radio module are based on this framework.
The software development framework provided by Espressif is intended for rapidly developing Internet of Things (IoT) applications, with Wi-Fi, Bluetooth, flexible power management and other advanced system features.
Users can develop applications in Windows, Linux and MacOS based on ESP-IDF.
The C programming language is used to develop code for the radio module of the e-puck2 robot and the ESP-IDF includes the FreeRTOS real time operating system.

Development environment

In order to build the firmware you need to install the toolchain, refer to http://esp-idf.readthedocs.io/en/latest/get-started/#setup-toolchain.
Once installed you can issue the command make flash from the directory Projects\ESP32_E-Puck_2 to build the firmware.
For more information have a look at http://esp-idf.readthedocs.io/en/latest/get-started/#build-and-flash.

Debugging

You can debug your code by printing some information on the serial port, then from the PC you can read these information by opening the Serial Monitor port (have a look at the chapter Finding the USB serial ports used to know what ports are availables).

Get the source code

The radio module firmware source code can be downloaded with the command:
git clone --recursive https://github.com/e-puck2/esp-idf.git

WiFi

The radio module wifi firmware source code can be downloaded with the command:
git clone -b wifi --recursive https://github.com/e-puck2/esp-idf.git