Getting Started with the Espressif ESP32-DevKitC

Janeu wrote on December 11, 2019:

Hi,

I’m running in Windows 7 environment.

I’m following the Getting Started with the Espressif ESP32-DevKitC to get the MQTT demo to work.
Link: https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html

I’m almost done, but at the point Flash and Run Amazon FreeRTOS I get the following error:

C:\AWS\ESP32\AmazonFreeRTOS\build>C:\Python27\python.exe …\vendors\espressif\es
p-idf\tools\idf.py erase_flash flash -B build
Setting IDF_PATH environment variable: C:\AWS\ESP32\AmazonFreeRTOS\vendors\espre
ssif\esp-idf
Running esptool.py in directory C:\AWS\ESP32\AmazonFreeRTOS\build\build
Executing “C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif
esp-idf\components/esptool_py/esptool/esptool.py -b 460800 erase_flash”…
Traceback (most recent call last):
File “…\vendors\espressif\esp-idf\tools\idf.py”, line 499, in
main()
File “…\vendors\espressif\esp-idf\tools\idf.py”, line 479, in main
execute_action(actions[0], actions[1:])
File “…\vendors\espressif\esp-idf\tools\idf.py”, line 473, in execute_action
function(action, args)
File “…\vendors\espressif\esp-idf\tools\idf.py”, line 249, in erase_flash
_run_tool(“esptool.py”, esptool_args, args.build_dir)
File “…\vendors\espressif\esp-idf\tools\idf.py”, line 77, in _run_tool
subprocess.check_call(args, env=os.environ, cwd=cwd)
File “C:\Python27\lib\subprocess.py”, line 185, in check_call
retcode = call(*popenargs, **kwargs)
File “C:\Python27\lib\subprocess.py”, line 172, in call
return Popen(*popenargs, **kwargs).wait()
File “C:\Python27\lib\subprocess.py”, line 394, in init
errread, errwrite)
File “C:\Python27\lib\subprocess.py”, line 644, in _execute_child
startupinfo)
WindowsError: [Error 267] The directory name is invalid

What has to be done?

Yuki-AWS wrote on December 12, 2019:

Hi Janeu,

In Getting Started page, under “Flash and Run Amazon FreeRTOS” –
“To erase the board’s flash, go to the directory and use the following command:”

Could you confirm you are running idf.py under directory, instead of / directory? From the log line you sent below –

C:\AWS\ESP32\AmazonFreeRTOS\build>C:\Python27\python.exe ..\vendors\espressif\es
p-idf\tools\idf.py erase_flash flash -B build

It seems you may need to go one level above before running this command.

Janeu wrote on December 13, 2019:

Hi Yuki-AWS,

Ok, if I instead start one level above, ie from:
C:\AWS\ESP32\AmazonFreeRTOS
then I come a bit further, before running into a new failure.

My result:
C:\AWS\ESP32\AmazonFreeRTOS>python.exe C:\AWS\ESP32\AmazonFreeRTOS\vendors\espre
ssif\esp-idf\tools\idf.py erase_flash -B build
Setting IDF_PATH environment variable: C:\AWS\ESP32\AmazonFreeRTOS\vendors\espre
ssif\esp-idf
Running esptool.py in directory C:\AWS\ESP32\AmazonFreeRTOS\build
Executing “C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif
esp-idf\components/esptool_py/esptool/esptool.py -b 460800 erase_flash”…
esptool.py v2.6
Traceback (most recent call last):
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2959, in
_main()
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2952, in _main
main()
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2637, in main
ser_list = sorted(ports.device for ports in list_ports.comports())
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2637, in
ser_list = sorted(ports.device for ports in list_ports.comports())
AttributeError: ‘tuple’ object has no attribute ‘device’
esptool.py failed with exit code 1

What is missing - the com port?

Yuki-AWS wrote on December 13, 2019:

I think you are right. It looks like the device may not be connected properly.


ser_list = sorted(ports.device for ports in list_ports.comports())
AttributeError: 'tuple' object has no attribute 'device'
esptool.py failed with exit code 1

To debug, could try below in python REPL terminal.


import serial.tools.list_ports as list_ports
list_ports.comports()

It should show what’s connected. Or could try other Linux command or device manager as well…

Janeu wrote on December 16, 2019:

Windows Device Manager shows:
Ports (COM & LPT)

  • Silicon Labs CP210x USB to UART Bridge (COM14)
  • Standard Serial over Bluetooth link (COM7)
  • Correct.+

REPL terminal response:

import serial.tools.list_ports as list_ports

<generator object comports at 0x00000000023C2B88>
+Probably a bad answer and therefore incorrect?+

But if I use another commands, the result is:

ts.comports() if port[2] != ‘n/a’]
[(‘COM14’, ‘Silicon Labs CP210x USB to UART Bridge (COM14)’, ‘USB VID:PID=10C4:E
A60 SNR=A4DA06D9E2A1E811A7AF2491F375B2A8’), (‘COM7’, ‘Standard Serial over Bluet
ooth link (COM7)’, ‘BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&000
0\8&16622CC3&0&000000000000_00000002’)]
+Looks correct.+

There is this text in the beginning of esptool.py:
esptool.py depends on pyserial, but there is a conflict with a currently installed package named ‘serial’.

You may be able to work around this by ‘pip uninstall serial; pip install pyserial’
but this may break other installed Python software that depends on ‘serial’.

There is no good fix for this right now, apart from configuring virtualenvs.
See https://github.com/espressif/esptool/issues/269#issuecomment-385298196 for discussion of the underlying issue(s).""")

There is a mismatch with serial and pyserial in my setup?

How to continue?

Janeu wrote on December 17, 2019:

Some finding: added the port explicity, -p COM14, in the command line made some progress.

C:\AWS\ESP32\AmazonFreeRTOS>C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\v
endors\espressif\esp-idf\tools\idf.py erase_flash -B build -p COM14
Setting IDF_PATH environment variable: C:\AWS\ESP32\AmazonFreeRTOS\vendors\espre
ssif\esp-idf
Running esptool.py in directory C:\AWS\ESP32\AmazonFreeRTOS\build
Executing “C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif
esp-idf\components/esptool_py/esptool/esptool.py -p COM14 -b 460800 erase_flash”

esptool.py v2.6
Serial port COM14
Connecting…
Traceback (most recent call last):
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2975, in
_main()
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2968, in _main
main()
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 2658, in main
esp = ESPLoader.detect_chip(each_port, initial_baud, args.before, args.trace
)
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 259, in detect_chip
detect_port.connect(connect_mode)
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 460, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 419, in _connect_attempt
self._setRTS(True) # EN=LOW, chip in reset
File “C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif\esp-idf\components/esptool
_py/esptool/esptool.py”, line 391, in _setRTS
self._port.setDTR(self._port.dtr)
AttributeError: ‘Serial’ object has no attribute ‘dtr’
esptool.py failed with exit code 1

Yuki-AWS wrote on December 17, 2019:

Apologies for the delay. From your previous post,


You may be able to work around this by 'pip uninstall serial; pip install pyserial' \
but this may break other installed Python software that depends on 'serial'.

esp-idf\tools\idf.py is provided by ESP and it seems (from the link you sent) it has hard dependency on a python component PySerial:[https://pythonhosted.org/pyserial/].

(I’m speculating from your post) It seems your environment has both Serial instead of PySerial. And I would try these in command line:


pip list                          <-- this shows you what you have for python. 
pip uninstall serial
pip install pyserial

Edited by: Yuki-AWS on Dec 17, 2019 12:05 PM

Janeu wrote on December 18, 2019:

So, I managed to step further. I tested to do a just test flash instead of an erase. It failed, but also give a tips to do necessary updates via:

C:\AWS\ESP32\AmazonFreeRTOS>C:\Python27\python.exe -m pip install --user -r C:/A
WS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/requirements.txt

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple
ase upgrade your Python as Python 2.7 won’t be maintained after that date. A fut
ure version of pip will drop support for Python 2.7. More details about Python 2
support in pip, can be found at https://pip.pypa.io/en/latest/development/relea
se-process/#python-2-support
Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from
-r C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/requirements.txt (line
4)) (41.2.0)
Collecting pyserial>=3.0 (from -r C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/
esp-idf/requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c09
07414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl
Collecting future>=0.15.2 (from -r C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif
/esp-idf/requirements.txt (line 9))
Using cached https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d5
8b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
Collecting cryptography>=2.1.4 (from -r C:/AWS/ESP32/AmazonFreeRTOS/vendors/espr
essif/esp-idf/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/c2/9f/fdabae150b995e2ad141
2d1fb80451ef5204ef068c964749ecf150b838e3/cryptography-2.8-cp27-cp27m-win_amd64.w
hl (1.4MB)
|################################| 1.5MB 1.4MB/s
Collecting six>=1.4.1 (from cryptography>=2.1.4->-r C:/AWS/ESP32/AmazonFreeRTOS/
vendors/espressif/esp-idf/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b6
56ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.1.4->-r C:/AWS/ESP32/AmazonF
reeRTOS/vendors/espressif/esp-idf/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/cb/27/0daf49c18f1280a2d235
37eb42424005ffe19787e1bf7fb5be117855197a/cffi-1.13.2-cp27-cp27m-win_amd64.whl (1
69kB)
|################################| 174kB 3.2MB/s
Collecting ipaddress; python_version < “3” (from cryptography>=2.1.4->-r C:/AWS/
ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/c2/f8/49697181b1651d8347d2
4c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl
Collecting enum34; python_version < “3” (from cryptography>=2.1.4->-r C:/AWS/ESP
32/AmazonFreeRTOS/vendors/espressif/esp-idf/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1
c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.1.4->-r C:/AWS/ES
P32/AmazonFreeRTOS/vendors/espressif/esp-idf/requirements.txt (line 10))
Installing collected packages: pyserial, future, six, pycparser, cffi, ipaddress
, enum34, cryptography
Running setup.py install for future … done
Successfully installed cffi-1.13.2 cryptography-2.8 enum34-1.1.6 future-0.18.2 i
paddress-1.0.23 pycparser-2.19 pyserial-3.4 six-1.13.0
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip’ comm
and.

Then I tested erase again and it seem to work:
C:\AWS\ESP32\AmazonFreeRTOS>C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\v
endors\espressif\esp-idf\tools\idf.py erase_flash -B build -p COM14

Setting IDF_PATH environment variable: C:\AWS\ESP32\AmazonFreeRTOS\vendors\espre
ssif\esp-idf
Running esptool.py in directory C:\AWS\ESP32\AmazonFreeRTOS\build
Executing “C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif
esp-idf\components/esptool_py/esptool/esptool.py -p COM14 -b 460800 erase_flash”

esptool.py v2.6
Serial port COM14
Connecting…
Detecting chip type… ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme
None
MAC: XX:XX:XX:XX:XX:XX
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Changed.
Erasing flash (this may take a while)…
Chip erase completed successfully in 9.6s
Hard resetting via RTS pin…
Done

The flash:
C:\AWS\ESP32\AmazonFreeRTOS>C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\v
endors\espressif\esp-idf\tools\idf.py flash -B build -p COM14

Setting IDF_PATH environment variable: C:\AWS\ESP32\AmazonFreeRTOS\vendors\espre
ssif\esp-idf
Running ninja in directory C:\AWS\ESP32\AmazonFreeRTOS\build
Executing “ninja all”…
[0/2] Re-checking globbed directories…
[1/2] Re-running CMake…
– Checking Python dependencies…
Python requirements from C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/r
equirements.txt are satisfied.
– Building for target esp32
– Component names: soc log heap freertos vfs newlib driver tcpip_adapter xtensa
-debug-module app_trace mbedtls micro-ecc bootloader_support spi_flash partition
table app_update ethernet nvs_flash pthread smartconfig_ack wpa_supplicant esp3
2 cxx amazon-freertos-common bootloader bt console esp_adc_cal esptool_py expat
wear_levelling sdmmc fatfs nghttp nimble openssl spiffs ulp
– Component paths: C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/compon
ents/soc;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/log;C:
/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/heap;C:/AWS/ESP32
/AmazonFreeRTOS/vendors/espressif/boards/esp32/aws_demos/application_code/espres
sif_code/freertos;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/componen
ts/vfs;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/newlib;C
:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/driver;C:/AWS/ES
P32/AmazonFreeRTOS/vendors/espressif/boards/esp32/aws_demos/application_code/esp
ressif_code/tcpip_adapter;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/
components/xtensa-debug-module;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp
-idf/components/app_trace;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/boards/e
sp32/aws_demos/application_code/espressif_code/mbedtls;C:/AWS/ESP32/AmazonFreeRT
OS/vendors/espressif/esp-idf/components/micro-ecc;C:/AWS/ESP32/AmazonFreeRTOS/ve
ndors/espressif/esp-idf/components/bootloader_support;C:/AWS/ESP32/AmazonFreeRTO
S/vendors/espressif/esp-idf/components/spi_flash;C:/AWS/ESP32/AmazonFreeRTOS/ven
dors/espressif/esp-idf/components/partition_table;C:/AWS/ESP32/AmazonFreeRTOS/ve
ndors/espressif/esp-idf/components/app_update;C:/AWS/ESP32/AmazonFreeRTOS/vendor
s/espressif/boards/esp32/aws_demos/application_code/espressif_code/ethernet;C:/A
WS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/nvs_flash;C:/AWS/ES
P32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/pthread;C:/AWS/ESP32/Ama
zonFreeRTOS/vendors/espressif/boards/esp32/aws_demos/application_code/espressif

code/smartconfig_ack;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/compo
nents/wpa_supplicant;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/compo
nents/esp32;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/cxx
;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/boards/esp32/aws_demos/applicatio
n_code/espressif_code/amazon-freertos-common;C:/AWS/ESP32/AmazonFreeRTOS/vendors
/espressif/esp-idf/components/bootloader;C:/AWS/ESP32/AmazonFreeRTOS/vendors/esp
ressif/esp-idf/components/bt;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-i
df/components/console;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/comp
onents/esp_adc_cal;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/compone
nts/esptool_py;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/
expat;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/wear_leve
lling;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/sdmmc;C:/
AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/fatfs;C:/AWS/ESP32
/AmazonFreeRTOS/vendors/espressif/esp-idf/components/nghttp;C:/AWS/ESP32/AmazonF
reeRTOS/vendors/espressif/esp-idf/components/nimble;C:/AWS/ESP32/AmazonFreeRTOS/
vendors/espressif/esp-idf/components/openssl;C:/AWS/ESP32/AmazonFreeRTOS/vendors
/espressif/esp-idf/components/spiffs;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espress
if/esp-idf/components/ulp
– IDF_VER: v3.1.5-105-g7313c836a5
fatal: not a git repository (or any of the parent directories): .git
– Project version: HEAD-HASH-NOTFOUND
fatal: not a git repository (or any of the parent directories): .git
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/build/esp-idf/esp32/esp32_ou
t.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.common.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.rom.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.peripherals.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.rom.libgcc.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.rom.spiram_incompatible_fns.ld
– Component libraries:
=========================Resolving dependencies==========================
All modules available

====================Configuration for Amazon FreeRTOS====================
Version: 201910.00
Git version: Unknown

Target microcontroller:
vendor: Espressif
board: ESP32-DevKitC
description: Development board produced by Espressif that comes in
two
variants either with ESP-WROOM-32 or ESP32-WROVER mod
ule
family: ESP32
data ram size: 520KB
program memory size: 4MB

Host platform:
OS: Windows-6.1.7601
Toolchain: xtensa-esp32
Toolchain path: C:/Program Files/Espressif/ESP-IDF Tools/tools
CMake generator: Ninja

Amazon FreeRTOS modules:
Modules to build: ble, ble_hal, ble_wifi_provisioning, common, crypto,

                       dev_mode_key_provisioning, freertos_plus_tcp, kernel,

mqtt,
pkcs11, pkcs11_implementation, platform, secure_socke
ts,
serializer, tls, wifi
Enabled by user: mqtt
Enabled by dependency: ble, ble_hal, ble_wifi_provisioning, common, crypto,

                       demo_base, dev_mode_key_provisioning, freertos, freer

tos_plus_
tcp, kernel, pkcs11, pkcs11_implementation, pkcs11_mb
edtls,
platform, secure_sockets, secure_sockets_freertos_plu
s_tcp,
serializer, tls, utils, wifi
3rdparty dependencies: mbedtls, pkcs11, tinycbor
Available demos: demo_ble, demo_ble_numeric_comparison, demo_mqtt, dem
o_tcp,
demo_wifi_provisioning
Available tests:

– Configuring done
– Generating done
– Build files have been written to: C:/AWS/ESP32/AmazonFreeRTOS/build
[0/2] Re-checking globbed directories…
[3/6] Generating …/aws_demos.bin
esptool.py v2.6
[4/6] Performing build step for ‘bootloader’
[0/1] Re-running CMake…
– Building for target esp32
– Component names: soc esp32 log bootloader spi_flash micro-ecc bootloader_supp
ort main esptool_py partition_table
– Component paths: C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/compon
ents/soc;C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/esp32;
C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/log;C:/AWS/ESP3
2/AmazonFreeRTOS/vendors/espressif/esp-idf/components/bootloader;C:/AWS/ESP32/Am
azonFreeRTOS/vendors/espressif/esp-idf/components/spi_flash;C:/AWS/ESP32/AmazonF
reeRTOS/vendors/espressif/esp-idf/components/micro-ecc;C:/AWS/ESP32/AmazonFreeRT
OS/vendors/espressif/esp-idf/components/bootloader_support;C:/AWS/ESP32/AmazonFr
eeRTOS/vendors/espressif/esp-idf/components/bootloader/subproject/main;C:/AWS/ES
P32/AmazonFreeRTOS/vendors/espressif/esp-idf/components/esptool_py;C:/AWS/ESP32/
AmazonFreeRTOS/vendors/espressif/esp-idf/components/partition_table
– Test component names:
– Test component paths:
– IDF_VER: v3.1.5-105-g7313c836a5
fatal: not a git repository (or any of the parent directories): .git
– Project version: HEAD-HASH-NOTFOUND
fatal: not a git repository (or any of the parent directories): .git
– Component libraries:
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/bootloader/subproject/main/esp32.bootloader.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/bootloader/subproject/main/esp32.bootloader.rom.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.rom.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.rom.spiram_incompatible_fns.ld
– Adding linker script C:/AWS/ESP32/AmazonFreeRTOS/vendors/espressif/esp-idf/co
mponents/esp32/ld/esp32.peripherals.ld
– Configuring done
– Generating done
– Build files have been written to: C:/AWS/ESP32/AmazonFreeRTOS/build/bootloade
r
[1/1] Generating …/bootloader.bin
esptool.py v2.6
Running esptool.py in directory C:\AWS\ESP32\AmazonFreeRTOS\build
Executing “C:\Python27\python.exe C:\AWS\ESP32\AmazonFreeRTOS\vendors\espressif
esp-idf\components/esptool_py/esptool/esptool.py -p COM14 -b 460800 write_flash
@flash_project_args”…
esptool.py -p COM14 -b 460800 write_flash --flash_mode dio --flash_freq 40m --fl
ash_size 4MB 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-t
able.bin 0x16000 ota_data_initial.bin 0x20000 aws_demos.bin
esptool.py v2.6
Serial port COM14
Connecting…
Detecting chip type… ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme
None
MAC: XX:XX:XX:XX:XX:XX
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Changed.
Configuring flash size…
Compressed 24128 bytes to 14355…
Wrote 24128 bytes (14355 compressed) at 0x00001000 in 0.3 seconds (effective 590
.3 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 118…
Wrote 3072 bytes (118 compressed) at 0x00008000 in 0.0 seconds (effective 2234.2
kbit/s)…
Hash of data verified.
Compressed 8192 bytes to 31…
Wrote 8192 bytes (31 compressed) at 0x00016000 in 0.0 seconds (effective 7281.7
kbit/s)…
Hash of data verified.
Compressed 951184 bytes to 585733…
Wrote 951184 bytes (585733 compressed) at 0x00020000 in 13.3 seconds (effective
570.8 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting via RTS pin…
Done

But the last step - Monitoring MQTT Messages on the Cloud - doesn’t work.

I’ve checked my router and the dev board isn’t know client there.
I think my credentials are correctly set.

I’ve restarted the dev board without any success.

How to proceed?

Janeu wrote on December 18, 2019:

Ok, let’s test.

Result at > pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple
ase upgrade your Python as Python 2.7 won’t be maintained after that date. A fut
ure version of pip will drop support for Python 2.7. More details about Python 2
support in pip, can be found at https://pip.pypa.io/en/latest/development/relea
se-process/#python-2-support
Package Version


pip 19.2.3
pyserial 2.7
setuptools 41.2.0
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip’ comm
and.

Result at > pip uninstall serial
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple
ase upgrade your Python as Python 2.7 won’t be maintained after that date. A fut
ure version of pip will drop support for Python 2.7. More details about Python 2
support in pip, can be found at https://pip.pypa.io/en/latest/development/relea
se-process/#python-2-support
WARNING: Skipping serial as it is not installed.

Result at > pip install pyserial
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple
ase upgrade your Python as Python 2.7 won’t be maintained after that date. A fut
ure version of pip will drop support for Python 2.7. More details about Python 2
support in pip, can be found at https://pip.pypa.io/en/latest/development/relea
se-process/#python-2-support
Requirement already satisfied: pyserial in c:\python27\lib\site-packages (2.7)
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip’ comm

Thus, I seem to have pyserlal and not serial already.

The Getting Started doc talks about Python 2.7, this is still valid? Or a step up is needed?

Or a more general question: Which items and versions should be used here?

DanG-AWS wrote on December 19, 2019:

Hello, after flashing the firmware image, what serial output do you see while monitoring? Note, you’re probably more likely to see all of the demo output if run the combined command described in https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html:

./vendors/espressif/esp-idf/tools/idf.py erase_flash flash monitor -p /dev/ttyUSB1 -B build

Janeu wrote on December 19, 2019:

When connect the dev board to the USB port (COM14) using PuTTY I get this result:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6228
load:0x40078000,len:11684
ho 0 tail 12 room 4
load:0x40080000,len:6112
entry 0x40080330
I (30) boot: ESP-IDF v3.1.5-105-g7313c836a5 2nd stage bootloader
I (30) boot: compile time 15:53:36
I (30) boot: Enabling RNG early entropy source…
I (36) boot: SPI Speed : 40MHz
I (40) boot: SPI Mode : DIO
I (44) boot: SPI Flash Size : 4MB
I (48) boot: Partition Table:
I (52) boot: ## Label Usage Type ST Offset Length
I (59) boot: 0 nvs WiFi data 01 02 00010000 00006000
I (66) boot: 1 otadata OTA data 01 00 00016000 00002000
I (74) boot: 2 phy_init RF data 01 01 00018000 00001000
I (81) boot: 3 ota_0 OTA app 00 10 00020000 00177000
I (89) boot: 4 ota_1 OTA app 00 11 001a0000 00177000
I (96) boot: 5 storage WiFi data 01 02 00317000 00010000
I (104) boot: End of partition table
I (108) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x1fda8 (130472) map
I (163) esp_image: segment 1: paddr=0x0003fdd0 vaddr=0x3ffc0000 size=0x00240 ( 576) load
I (163) esp_image: segment 2: paddr=0x00040018 vaddr=0x400d0018 size=0xae398 (713624) map
I (420) esp_image: segment 3: paddr=0x000ee3b8 vaddr=0x3ffc0240 size=0x0300c ( 12300) load
I (425) esp_image: segment 4: paddr=0x000f13cc vaddr=0x40080000 size=0x00400 ( 1024) load
I (427) esp_image: segment 5: paddr=0x000f17d4 vaddr=0x40080400 size=0x16b90 ( 93072) load
I (488) boot: Loaded app from partition at offset 0x20000
I (488) boot: ota rollback check done
I (488) boot: Disabling RNG early entropy source…
I (493) cpu_start: Pro cpu up.
I (496) cpu_start: Single core mode
I (501) heap_init: Initializing. RAM available for dynamic allocation:
I (507) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (513) heap_init: At 3FFCFDA0 len 00010260 (64 KiB): DRAM
I (520) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (526) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (532) heap_init: At 40096F90 len 00009070 (36 KiB): IRAM
I (539) cpu_start: Pro cpu start user code
I (221) cpu_start: Starting scheduler on PRO CPU.
I (249) uart: queue free spaces: 10
I (259) PKCS11: Initializing NVS partition: “storage”
E (289) PKCS11: failed nvs get file size 4354 0
0 6 [main] Write certificate…
I (419) BTDM_INIT: BT controller compile version [382a548]

I (419) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (479) phy: phy_version: 4009, e7844c0, Jul 15 2019, 13:20:06, 0, 0
1 47 [iot_thread] [INFO ][DEMO][470] ---------STARTING DEMO---------

2 47 [iot_thread] [INFO ][INIT][470] SDK successfully initialized.
GAP procedure initiated: stop advertising.
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=51 adv_itvl_max=102
I (799) wifi: wifi driver task: 3ffda194, prio:23, stack:3584, core=0
I (799) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (799) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (819) wifi: wifi firmware version: 3c46a62
I (819) wifi: config NVS flash: enabled
I (819) wifi: config nano formating: disabled
I (819) wifi: Init dynamic tx buffer num: 32
I (829) wifi: Init data frame dynamic rx buffer num: 32
I (829) wifi: Init management frame dynamic rx buffer num: 32
I (839) wifi: Init management short buffer num: 32
I (839) wifi: Init static rx buffer size: 1600
I (839) wifi: Init static rx buffer num: 10
I (849) wifi: Init dynamic rx buffer num: 32
I (859) wifi: mode : sta (b4:…:a9)
I (859) WIFI: SYSTEM_EVENT_STA_START
I (2909) WIFI: SYSTEM_EVENT_STA_DISCONNECTED: 201
I (5959) WIFI: SYSTEM_EVENT_STA_DISCONNECTED: 201
I (10009) WIFI: SYSTEM_EVENT_STA_DISCONNECTED: 201
I (16059) WIFI: SYSTEM_EVENT_STA_DISCONNECTED: 201

In the CMAKE GUI I have only activated AFR_ENABLES_DEMOS and AFR_MODULE_mqtt.
I guess the other demos is not needed.

How to proceed with the Wi-Fi connection?

Janeu wrote on December 20, 2019:

As seen, I got:
SYSTEM_EVENT_STA_START
SYSTEM_EVENT_STA_DISCONNECTED

But I assume it should be:
SYSTEM_EVENT_STA_START
SYSTEM_EVENT_STA_CONNECTED
SYSTEM_EVENT_STA_GOT_IP

I’ve added ESP_LOGi() lines in the function WIFI_ConnectAP() to check the network parameters and for me it looks ok.

Any idea what I can check or so?

Gaurav-Aggarwal-AWS wrote on December 30, 2019:

Did it work for you? Can you check that you have good WiFi signal strength (may be by getting closer to your router)? Note that ESP only supports 2.4G and so you need to ensure that you are not trying to connect to 5G.

Thanks.