ESP32_DevKitC fails to connect to WiFi running FreeRTOS

PugetBound wrote on June 11, 2019:

Hello,
I’ve followed the getting started guide to run FreeRTOS on ESP32_DevKitC. I’m able to build the Make files etc, but when I run $make flash monitor it hangs on starting WiFi.

$ make flash monitor
Flashing binaries to serial port COM8 (app at offset 0x20000 )…
esptool.py v2.6
Serial port COM8
Connecting…
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: cc:50:e3:92:57:48
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 4MB
Compressed 23808 bytes to 14108…
Wrote 23808 bytes (14108 compressed) at 0x00001000 in 1.3 seconds (effective 152.3 kbit/s)…
Hash of data verified.
Compressed 643456 bytes to 404078…
Wrote 643456 bytes (404078 compressed) at 0x00020000 in 35.7 seconds (effective 144.0 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 141…
Wrote 3072 bytes (141 compressed) at 0x00008000 in 0.0 seconds (effective 1094.8 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting via RTS pin…
MONITOR
— idf_monitor on COM8 115200 —
— Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
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:6348
load:0x40078000,len:11276
ho 0 tail 12 room 4
load:0x40080000,len:6084
0x40080000: _iram_start at C:/users/xxxxx/Documents/Github/amazon-freertos/lib/FreeRTOS/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:
1685

entry 0x4008032c
0x4008032c: _KernelExceptionVector at ??:?

I (30) boot: ESP-IDF v3.1.3-25-g36733db8d 2nd stage bootloader
I (30) boot: compile time 14:57:56
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 (67) 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=0x14744 ( 83780) map
I (147) esp_image: segment 1: paddr=0x0003476c vaddr=0x3ffc0000 size=0x029b4 ( 10676) load
I (151) esp_image: segment 2: paddr=0x00037128 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at C:/users/xxxxx/Documents/Github/amazon-freertos/lib/FreeRTOS/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:
1685

I (154) esp_image: segment 3: paddr=0x00037530 vaddr=0x40080400 size=0x08ae0 ( 35552) load
I (177) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0x75b74 (482164) map
0x400d0018: _stext at ??:?

I (346) esp_image: segment 5: paddr=0x000b5b94 vaddr=0x40088ee0 size=0x075c4 ( 30148) load
0x40088ee0: coex_timer_ts_start_disalarm at ??:?

I (368) boot: Loaded app from partition at offset 0x20000
I (369) boot: ota rollback check done
I (369) boot: Disabling RNG early entropy source…
I (373) cpu_start: Pro cpu up.
I (377) cpu_start: Single core mode
I (382) heap_init: Initializing. RAM available for dynamic allocation:
I (388) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (394) heap_init: At 3FFD1058 len 0000EFA8 (59 KiB): DRAM
I (401) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (407) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (413) heap_init: At 400904A4 len 0000FB5C (62 KiB): IRAM
I (419) cpu_start: Pro cpu start user code
I (102) cpu_start: Starting scheduler on PRO CPU.
I (130) wifi: wifi driver task: 3ffd9274, prio:23, stack:3584, core=0
I (130) wifi: wifi firmware version: dbb148a
I (130) wifi: config NVS flash: enabled
I (140) wifi: config nano formating: disabled
I (140) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (150) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (160) wifi: Init dynamic tx buffer num: 32
I (170) wifi: Init data frame dynamic rx buffer num: 5
I (170) wifi: Init management frame dynamic rx buffer num: 5
I (170) wifi: Init static rx buffer size: 1600
I (180) wifi: Init static rx buffer num: 5
I (180) wifi: Init dynamic rx buffer num: 5
0 7 [main] WiFi module initialized. Connecting to AP …
W (190) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
I (370) phy: phy_version: 4008, c9ae59f, Jan 25 2019, 16:54:06, 0, 2
I (380) wifi: mode : sta (cc:50:e3:92:57:48)
I (380) WIFI: SYSTEM_EVENT_STA_START

It just sits here and never connects to my WAP.
So I know something is setup wrong, but need help to identify where.

PB

Edited by: PugetBound on Jun 11, 2019 8:09 AM

Edited by: PugetBound on Jun 12, 2019 9:01 AM
Doing more testing I find that the SetupAWS.py script is throwing errors:

$ python SetupAWS.py setup
Traceback (most recent call last):
File “SetupAWS.py”, line 204, in
setup()
File “SetupAWS.py”, line 156, in setup
prereq()
File “SetupAWS.py”, line 21, in prereq
json_text = json.load(file)
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/init.py”, line 291, in load
**kw)
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/decoder.py”, line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid \escape: line 2 column 25 (char 26)

I’ve deleted the ‘Thing’, ‘Certificate’, and ‘Policy’ in my IOT Core account.
Tried cleanup and all other command switches with the setup script, but it always throws these errors.

PB

Gaurav-Aggarwal-AWS wrote on June 12, 2019:

Sorry to hear that the setup does not work for you. Would please check if WiFi SSID and Password are correctly configured in https://github.com/aws/amazon-freertos/blob/master/demos/common/include/aws_clientcredential.h#L58.

Thanks.

PugetBound wrote on June 14, 2019:

Nothing has populated in the aws_clientcredentials.h
I’m guessing that because SetupAWS.py setup is failing with these errors it’s not taking the parameters from configuation.json and populating this file?

$ python SetupAWS.py setup
Traceback (most recent call last):
File “SetupAWS.py”, line 205, in
setup()
File “SetupAWS.py”, line 157, in setup
prereq()
File “SetupAWS.py”, line 22, in prereq
json_text = json.load(file)
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/init.py”, line 291, in load
**kw)
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:/Users/xxxxxxx/Downloads/Software/Tools/esp32_win32_msys2_environment_and_toolchain-20181001/msys32/mingw32/lib/python2.7/json/decoder.py”, line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid control character at: line 2 column 108 (char 109)

I’ll try coding the wifi parameters in the credentials file and test.

Thanks,
PB

Still will not connect, just hangs at “SYSTEM_EVENT_STA_START”
No client connection activity monitored on the WAP.

I (255) phy: phy_version: 4008, c9ae59f, Jan 25 2019, 16:54:06, 0, 0
I (255) wifi: mode : sta (cc:50:e3:92:57:48)
I (255) WIFI: SYSTEM_EVENT_STA_START

Edited by: PugetBound on Jun 14, 2019 8:44 AM

Gaurav-Aggarwal-AWS wrote on June 17, 2019:

It seems that your configuration.json file has some invalid characters which is causing the setup script to fail. What is the content of configuration.json and how are you populating it?

Thanks.

Talisx wrote on August 03, 2019:

i got the same Problem with the ESP-WROVER Kit which is also a recommended development board.
my configure.json:
{
“afr_source_dir”:"/home/torsten/amazon-freertos",
“thing_name”:“ESP”,
“wifi_ssid”:“WLAN-E33E75”,
“wifi_password”:“7856956690585151”,
“wifi_security”:“eWiFiSecurityWPA2”
}
the wifi test files from espressif worked for me, but the aws mqtt test project gives the same error as above.
I work with Linux 18.04.

about help i would be much appreciated.

DanG-AWS wrote on August 15, 2019:

Hello, would it be possible for you to attach your configuration JSON file here? Thank you.

YohanMetalform wrote on November 14, 2019:

Hi DanG-AWS

I have been having troubles setting up the file configure.json, I am not sure if I am establishing the right format of is something missing, I tried checking the trends already created in this Forum and I couldn’t find any solution out of the ones already created. How I am setting is like below:

{
“afr_source_dir”:"/home/yohan/Desktop/AmazonFreeRTOS-OTA",
“thing_name”:“thing”,
“wifi_ssid”:“",
“wifi_password”:"
*”,
“wifi_security”:“eWiFiSecurityWPA2”
}

I realized that this wasn’t with the right format when in the flashing process, the process was freezing in the next command.

I (1234) WIFI: SYSTEM_EVENT_STA_START

Do you know what is the right format or if I am missing something? I have tried different configurations
Much appreciated your help

Carl-Lundin-AWS wrote on November 14, 2019:

Hello YohanMetalform,

That behavior indicates invalid WiFi credentials. If you are trying to run a demo can you manually edit demos/include/aws_clientcredential.h If you are trying to run a test can you manually edit tests/include/aws_clientcredential.h. Double check that you the information you enter in the specified file matches the WiFi endpoint you are trying to get to. Can you attach the logs of running device, and when you try to configure the device with SetUp.py?