St-device-sdk-c switch_example wifi problem

@edukinara: here you go.
I was just looking at it but didn’t see anything critical.

$ ./build.sh apps/esp8266/switch_example monitor
Toolchain path: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-100-ge567ec7b
Expected to see version: crosstool-ng-1.22.0-92-g8facf4c
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
Compiler version: 5.2.0
MONITOR
--- idf_monitor on COM4 74880 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 6544, room 16
0x40100000: _stext at ??:?

tail 0
chksum 0xb7
load 0x3ffe8408, len 24, room 8
tail 0
chksum 0x3e
load 0x3ffe8420, len 2832, room 8
tail 8
chksum 0x01
I (292) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (302) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (472) phy_init: phy ver: 1055_12
I (472) reset_reason: RTC reset 2 wakeup 0 store 0, reason is 2
I (472) [IoT]: _iot_bsp_fs_encryption(98) > 'nvs' is encrypted
I (492) [IoT]: _dump_device_info(638) > firmware_version: f1
I (492) [IoT]: iot_bsp_wifi_init(156) > [esp8266] iot_bsp_wifi_init
I (512) [IoT]: iot_bsp_wifi_init(194) > [esp8266] iot_bsp_wifi_init done
I (522) [IoT]: st_conn_init(1312) > stdk_version : 1.3.6
I (522) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (532) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (552) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (562) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (582) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (2592) [IoT]: st_conn_start(1757) > st_conn_start start (no-pin)
I (2592) [IoT]: _do_iot_main_command(412) > curr_main_cmd:9, curr_main_state:-1/-1
I (2602) [IoT]: _do_update_timeout(158) > Current timeout : 100000 for 0
I (2612) [IoT]: _do_status_report(262) > Call usr status_cb with 1/0
status: 1, stat: 0
I (2622) [IoT]: _do_iot_main_command(412) > curr_main_cmd:2, curr_main_state:-1/0
W (2632) [IoT]: iot_bsp_fs_read(297) > not found 'WifiProvStatus'
W (2642) [IoT]: iot_security_storage_read(141) > id:1 not found
W (2652) [IoT]: _do_iot_main_command(529) > There are no prov data in NV

W (2672) [IoT]: iot_security_storage_remove(211) > id:10 not found
I (2682) [IoT]: _do_cmd_tout_check(913) > New state updated for 0
I (2692) [IoT]: _do_iot_main_command(412) > curr_main_cmd:9, curr_main_state:0/0
I (2702) [IoT]: iot_bsp_wifi_set_mode(212) > iot_bsp_wifi_set_mode = 1
I (2712) [IoT]: iot_bsp_wifi_set_mode(243) > WiFi Station Started
I (5132) [IoT]: event_handler(145) > event_handler = 1
I (5222) [IoT]: iot_easysetup_create_ssid(100) > >> ESP8266JustWo[SyXX] <<
I (5222) [IoT]: _do_update_timeout(158) > Current timeout : 300000 for 1
I (5232) [IoT]: _do_iot_main_command(412) > curr_main_cmd:1, curr_main_state:0/1
I (5242) [IoT]: iot_bsp_wifi_set_mode(212) > iot_bsp_wifi_set_mode = 3
I (5262) [IoT]: event_handler(121) > SYSTEM_EVENT_AP_START
I (5272) [IoT]: event_handler(126) > SYSTEM_EVENT_AP_STOP
I (5272) [IoT]: event_handler(121) > SYSTEM_EVENT_AP_START
I (5272) [IoT]: iot_bsp_wifi_set_mode(360) > AP Mode Started
I (5282) [IoT]: iot_easysetup_init(426) > IOT_STATE_PROV_ES_START
I (5292) [IoT]: es_http_init(264) > http tcp init!!
I (5302) [IoT]: iot_easysetup_init(446) > IOT_STATE_PROV_ES_INIT_DONE
I (5312) [IoT]: _do_cmd_tout_check(913) > New state updated for 1
I (5322) [IoT]: _do_status_report(262) > Call usr status_cb with 2/1
status: 2, stat: 1

here are some parts from adb that I was able to corelate to this device:

Is following expected?

getCapiEncryptedKey - response body is empty

log:

08-25 11:08:11.247 16706 16706 E [-8]oneconnect[1.7.51.42_01][MAIN_UI]: [EasySetup]GetCapiEncryptedKeyState.getCapiEncryptedKey - response body is empty
08-25 11:08:11.248 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: [EasySetup]BaseStateMachine.showError - errorCode:81-001-MBL
08-25 11:08:11.248 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: OcfLightSetupController.onEvent - eventType : EVENT_DIALOG_ON_DISMISS , CONNECTING_PAGE
08-25 11:08:11.248 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: OcfLightSetupController.onCommonEvent - eventType : EVENT_DIALOG_ON_DISMISS
08-25 11:08:11.249 16706 16706 W [-8]oneconnect[1.7.51.42_01][MAIN_UI]: [EasySetup]EasySetupProgressCircle.runProgressAnimation - start from 34
08-25 11:08:11.250 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: NetUtil.setFmcEnabled - SEP not supported
08-25 11:08:11.250 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: [EasySetup]WifiHelper.connect - 
08-25 11:08:11.251 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: [EasySetup]WifiHelper.checkWifiConnected - isWifiConnected: true, check ssid: ($)-c(5), currentNetwork: ($)-c(5)
08-25 11:08:11.256 15825 15849 I [-8]oneconnect[1.7.51.42_01][CORE]: CloudLogger.send - log = {"apconnected":{"connectedfreq":5745,"connectedssid":"($)-c(5)"},"apdual":{"isconnecteddual":false,"issupport5g":false},"aphomeap":{"auth":"","capabilities":"","enc":"","freq":0,"hidden":"","pwexists":"","ssid":"UNKNOWN"},"aprssi":{"devicehomerssi":"0","mobilehomerssi":"-61","softaprssi":-60},"apwifiselect":{"devcnt":0,"devtimeout":false,"scancnt":0,"state":"AUTO"},"bintype":"user","bondingresult":"","btfwver":"BCM4375B1 Davinci 1RH JPN Ant0 [Version: 0141.0271]","connectedothercount":0,"ctry":"US","currsession":"","currtime":"2020-08-25 11:08:11","d2dping":-1,"dnstime":204,"dumpfileid":"","dumpfilepath":"","elapdiscovery":0,"elaptime":30310,"entry":"MANUAL_ADD","errcode":"81-001-MBL","errcodeMain":"81","errcodeSub":"001","esconntype":"WIFI","eslog":"08-25 11:07:49.597 - [-8]oneconnect[1.7.51.42_01][CORE].EasySetupDiscoveryManager.startDiscovery - scantype:_WIFI_FULL_MANUAL_SETUP, flush:true\n08-25 11:07:49.613 - [-8]oneconnect[1.7.51.42_01][CORE].EasySetupDiscoveryManager.startDiscovery - type:[SamsungStandard_E4], timeout:300000, includeCloud:false, excludeL3:true\n08-25 11:07:49.613 - [-8]oneconnect[1.7.51.42_01][CORE].EasySetupDiscoveryManager.startDiscovery - skip, previous discovery is not finished\n08-25 11:07:53.621 - [-8]oneconnect[1.7.51.42_01][CORE].EasySetupDiscoveryManager.DiscoveryHandler - [D2S] found target:[Name]($)-E(32)[Pid]null[Pool]false[DeviceType]SAMSUNG_OCF_SETUP[Discover]_WIFI[Services]None[Connected]false[ConType]NONE[size()]1[OCFDiscovery]_WIFI[OCFOwned]-1\n08-25 11:07:53.624 - [-8]oneconnect[1.7.51.42_01][CORE].EasySetupDiscoveryManager.DiscoveryHandler - [D2S] found target:[ESDT]SamsungStandard_E4[Name]($)-E(32)[DiscoveryType]_WIFI[Protocol]OCF[ManualSetup]false[ShpSetupFromDeviceCard]false[StandardSsidInfo][Name]($)-E(13)[Ver]4[MnId]0Avq[SetuId]000[ExtType]6[ExtValue]cfj2SyXX[ApConnected]false[WiredConnected]false\n08-25 11:07:54.598 - [-8]oneconnect[1.7.51.42_01][CORE].EasySetupDiscoveryManager.stopDiscovery - type:[SamsungStandard_E4], timeout:300000,includeCloud:false, excludeL3:true\n08-25 11:07:55.019 - [-8]oneconnect[1.7.51.42_01][CORE].[EasySetup]EasySetupMcSignInState.EasySetupMcSignIn - IN\n08-25 11:07:55.022 - [-8]oneconnect[1.7.51.42_01][CORE].[EasySetup]GetAuthState.GetAuthState - IN\n08-25 11:08:01.733 - [-8]oneconnect[1.7.51.42_01][CORE].[EasySetup]OCFEasySetupProtocol.QcEasySetupHandler - GET_ACCESSTOKEN\n08-25 11:08:06.997 - [-8]oneconnect[1.7.51.42_01][CORE].[EasySetup]GetCapiEncryptedKeyState.GetCapiEncryptedKeyState - IN\n","esver":"UNKNOWN","gattstate":{"blereport":"","connstate":"NONE"},"helpcardopencount":0,"histories":[{"step":"INTRO","time":14079},{"step":"SAMSUNGACCOUNT","time":16228}],"installer":"com.sec.android.app.samsungapps","isd2ddevice":"false","isemailid":"true","isfileupload":false,"isrssifeatureon":"true","isuserinputpin":"false","lang":"en","manualretrycount":0,"manufacturedyear":0,"mfr":"samsung","model":"SM-N975U1","multidevicedetectedcount":-1,"os":"android","osver":"29","otmreason":"UNKNOWN","otmsupportfeature":0,"ownmatch":"true","prevsession":"","prevtgtstatus":"","provisioningresults":[],"registeringstate":"","rescan":"false","result":"FAIL","retrycnt":0,"scanresultcount":0,"sn":{"number":"","type":"SCANNING"},"stver":"1.7.51.42","tgtcat":"SamsungStandardSsid","tgtfwver":"UNKNOWN","tgtlogid":"","tgtprot":"OCF","tgtssid":"ESP8266JustWo_E40Avq0006cfj2SyXX","tgttype":"_E4","tokenretrycount":0,"ultrasound":{"permission":"","result":""},"wifihubcombi":"UNKNOWN"}
08-25 11:08:11.266 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: OcfLightSetupController.onEvent - eventType : SHOW_ERROR_POPUP , CONNECTING_PAGE
08-25 11:08:11.266 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: OcfLightSetupController.onCommonEvent - eventType : SHOW_ERROR_POPUP
08-25 11:08:11.267 16706 16706 E [-8]oneconnect[1.7.51.42_01][MAIN_UI]: OcfLightSetupController.proceedShowErrorPopup - ErrorCode = 81-001isSoftAp = true
08-25 11:08:11.267 16706 16706 I [-8]oneconnect[1.7.51.42_01][MAIN_UI]: OcfLightSetupController.showFailDialog - errorCode = 81-001
08-25 11:08:11.268 16706 16706 W [-8]oneconnect[1.7.51.42_01][MAIN_UI]: [EasySetup]AbstractEasySetupPage.onEvent - not handled event : SHOW_ERROR_POPUP

Hi, @Bartek Could you let me know your test device’s full ssid string?
You can find it from your mobile device’s “setting” --> “Connections”
or by adding log print like below

--- a/src/easysetup/http/tcp/iot_easysetup_d2d_tcp.c
+++ b/src/easysetup/http/tcp/iot_easysetup_d2d_tcp.c
@@ -104,6 +104,7 @@ iot_error_t iot_easysetup_create_ssid(struct iot_devconf_prov_data *devconf, cha
        snprintf(ssid_build, sizeof(ssid_build), "%s_E4%3s%3s%1d%4s%4s",
                        devconf->device_onboarding_id, devconf->mnid, devconf->setupid, setup_type, hashed_sn, last_sn);
 
+       IOT_INFO("%s", ssid_build);
        memcpy(ssid, ssid_build, ssid_len < strlen(ssid_build) ? ssid_len : strlen(ssid_build));
 out:
        if (err && devconf->hashed_sn) 
1 Like

Hi @kwanghui,

I’m also on the GitHub thread and as per that discussion I have created new device and onboarding.
As per the log above the SSID was

"tgtssid":"ESP8266JustWo_E40Avq0006cfj2SyXX"
1 Like

Hi @bartek, I just query your test device from the database. It registered successfully.

I did do the same thing today on my side. but it works.

Could you help me to get dumpstate log of mobile device by referring below article?
(you don’t need to change debug level - step 3)

Please send log to build@smartthings.com

Thanks

Log file sent

Has anyone with the latest iPhone app 1.6.51-435 been able to get the wifi connections working?

I have, although I scanned a QR code using the camera app to start on-boarding the app. I followed this:
https://developer.samsung.com/codelab/smartthings/smartthings-device-sdk/development.html#Step-1-Register-and-deploy-to-test-your-device.
There is a python script for generating the QR Code.

Done all those steps.

The code supplied on that page has an error, the version on github looks to be fixed. Perhaps Samsung would like to fix it in the codelab too?

Im getting very frustrated with this now. As far as I can tell I have done everything as documented in all the various place, all slightly differently, some with chunks missing. Come on Samsung sort it out it cant be that hard to be consistent and put a little effort into testing and keeping things consistent.

I have gone out and purchased another Samsung phone today in the hope that would fix my problem and the Android version of the app would work better.

It doesnt. Im getting exactly the same problem, it never joins the wifi, and as far as I can tell never attempts to. The App just goes searching for device and doesnt find it. If I monitor the device I dont see any attempts to join, I can see the AP created if I browse from the phone but try to connect and it just asks for a password.

Also getting this everytime i try to use monitor

File “/home/xxxxx/st-device-sdk-c-ref/bsp/esp8266/tools/idf_monitor.py”, line 102, in is_ascii
if b > ‘\x7f’:
TypeError: ‘>’ not supported between instances of ‘int’ and ‘str’

On the iphone I see the erro is failToGetEasysetupBlob
On the Android it is 81-001

App versions
Android version 1.7.51.42
ios version 1.6.51-435

I just realized that the link was what was supposed to be in the QR, not a link to generate the QR code. My bad.

Hello, everyone

The st-device-sdk-c-ref repository has been updated. Please pull these changes and integrate the device as a new project.

If anyone still having issues, please let me know.

I assume the fix is on master. Or is it on develop branch?

Anyway. I have cloned master put the same onboarding_config.json and device_info.json files and now when I run

 ./build.sh apps/esp8266/switch_example/ monitor

I get

E (492) [IoT]: iot_api_onboarding_config_load(520) > [mnId] wrong onboarding config value detected: MNID
E (502) [IoT]: st_conn_init(1228) > failed loading onboarding profile (-5)

ps. I double checked the MNID is set in the file

Well that made no difference what so ever.

In fact are you sure the github has been updated? It says 2 days ago and that looked to be pretty much stuff for esp32. Or perhaps Im missing something?

Here is the capture of the log from the device - just in case it helps

load 0x40100000, len 6544, room 16
tail 0
chksum 0xb9
load 0x3ffe8408, len 24, room 8
tail 0
chksum 0x30
load 0x3ffe8420, len 2832, room 8
tail 8
chksum 0x0f
I (297) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (297) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (477) phy_init: phy ver: 1055_12
I (477) reset_reason: RTC reset 2 wakeup 0 store 0, reason is 2
I (477) [IoT]: _iot_bsp_fs_encryption(98) > ‘nvs’ is encrypted
I (497) [IoT]: _dump_device_info(641) > firmware_version: switch1
I (497) [IoT]: iot_bsp_wifi_init(156) > [esp8266] iot_bsp_wifi_init
I (517) [IoT]: iot_bsp_wifi_init(194) > [esp8266] iot_bsp_wifi_init done
I (517) [IoT]: st_conn_init(1307) > stdk_version : 1.3.3
I (527) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (537) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (557) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (567) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (587) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (2597) [IoT]: st_conn_start(1752) > st_conn_start start (no-pin)
I (2597) [IoT]: _do_iot_main_command(412) > curr_main_cmd:9, curr_main_state:-1/-1
I (2607) [IoT]: _do_update_timeout(158) > Current timeout : 100000 for 0
I (2617) [IoT]: _do_status_report(262) > Call usr status_cb with 1/0
status: 1, stat: 0
I (2627) [IoT]: _do_iot_main_command(412) > curr_main_cmd:2, curr_main_state:-1/0
W (2637) [IoT]: iot_bsp_fs_read(297) > not found ‘WifiProvStatus’
W (2647) [IoT]: iot_security_storage_read(141) > id:1 not found
W (2657) [IoT]: _do_iot_main_command(529) > There are no prov data in NV

W (2677) [IoT]: iot_security_storage_remove(211) > id:10 not found
I (2687) [IoT]: _do_cmd_tout_check(908) > New state updated for 0
I (2697) [IoT]: _do_iot_main_command(412) > curr_main_cmd:9, curr_main_state:0/0
I (2707) [IoT]: iot_bsp_wifi_set_mode(212) > iot_bsp_wifi_set_mode = 1
I (2717) [IoT]: iot_bsp_wifi_set_mode(243) > WiFi Station Started
I (5137) [IoT]: event_handler(145) > event_handler = 1
I (5227) [IoT]: iot_easysetup_create_ssid(100) > >> Switch1[QxZV] <<
I (5227) [IoT]: _do_update_timeout(158) > Current timeout : 300000 for 1
I (5237) [IoT]: _do_iot_main_command(412) > curr_main_cmd:1, curr_main_state:0/1
I (5247) [IoT]: iot_bsp_wifi_set_mode(212) > iot_bsp_wifi_set_mode = 3
I (5267) [IoT]: event_handler(121) > SYSTEM_EVENT_AP_START
I (5277) [IoT]: event_handler(126) > SYSTEM_EVENT_AP_STOP
I (5277) [IoT]: event_handler(121) > SYSTEM_EVENT_AP_START
I (5277) [IoT]: iot_bsp_wifi_set_mode(360) > AP Mode Started
I (5287) [IoT]: iot_easysetup_init(426) > IOT_STATE_PROV_ES_START
I (5297) [IoT]: es_http_init(264) > http tcp init!!
I (5307) [IoT]: iot_easysetup_init(446) > IOT_STATE_PROV_ES_INIT_DONE
I (5317) [IoT]: _do_cmd_tout_check(908) > New state updated for 1
I (5327) [IoT]: _do_status_report(262) > Call usr status_cb with 2/1
status: 2, stat: 1
W (305237) [IoT]: _do_cmd_tout_check(895) > New state changing timeout

@bmc @Bartek. here’s a copy of my sdkconfig and partition table that seems to allow flashing and on-borading on the ESP8266.

@bmc, I think you are having the same issue I was having getting the app to see and connect to the device AP. I had to regenerate new serial and keys, update the device_info.json int the project file with the new one, re-register the device in DWS and use the QR code to start the on-bording process on the camera app vs the ST app.

Also, make sure pull the latest changes from the sdk-ref repo and run any patches.