{"action":"created","issue":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/1857","repository_url":"https://api.github.com/repos/espressif/esp-idf","labels_url":"https://api.github.com/repos/espressif/esp-idf/issues/1857/labels{/name}","comments_url":"https://api.github.com/repos/espressif/esp-idf/issues/1857/comments","events_url":"https://api.github.com/repos/espressif/esp-idf/issues/1857/events","html_url":"https://github.com/espressif/esp-idf/issues/1857","id":314334041,"number":1857,"title":"Calling iot_button_create() causes RTCWDT_RTC_RESET","user":{"login":"tuupola","id":21913,"avatar_url":"https://avatars0.githubusercontent.com/u/21913?v=4","gravatar_id":"","url":"https://api.github.com/users/tuupola","html_url":"https://github.com/tuupola","followers_url":"https://api.github.com/users/tuupola/followers","following_url":"https://api.github.com/users/tuupola/following{/other_user}","gists_url":"https://api.github.com/users/tuupola/gists{/gist_id}","starred_url":"https://api.github.com/users/tuupola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuupola/subscriptions","organizations_url":"https://api.github.com/users/tuupola/orgs","repos_url":"https://api.github.com/users/tuupola/repos","events_url":"https://api.github.com/users/tuupola/events{/privacy}","received_events_url":"https://api.github.com/users/tuupola/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-04-14T14:41:23Z","updated_at":"2018-05-08T18:09:18Z","closed_at":"2018-04-15T05:52:32Z","author_association":"NONE","body":"While testing the button class from `esp-iot-solution` I noticed every time I call the `iot_button_create()` it causes the program to crash. Serial console shows these error messages in a loop.\r\n\r\n```\r\nrst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)\r\nflash read err, 1000\r\nets_main.c 371\r\nets Jun  8 2016 00:22:57\r\n\r\nrst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)\r\nflash read err, 1000\r\nets_main.c 371\r\nets Jun  8 2016 00:22:57\r\n\r\n...\r\n```\r\nFull code can be seen at [tuupola/esp32-examples/tree/master/007-m5stack-iot-button](https://github.com/tuupola/esp32-examples/tree/master/007-m5stack-iot-button).  Important part of the code below. \r\n\r\n```c\r\n#define BUTTON_A_PIN          39\r\n#define BUTTON_ACTIVE_LEVEL   1\r\n\r\n#include \"freertos/FreeRTOS.h\"\r\n#include \"freertos/task.h\"\r\n#include \"iot_button.h\"\r\n#include \"esp_log.h\"\r\n\r\nstatic const char* TAG = \"main\";\r\n\r\nstatic void dummy_task(void* arg)\r\n{\r\n    while (1) {\r\n        ESP_LOGI(TAG, \"My name is Mud.\");\r\n        vTaskDelay(1000 / portTICK_RATE_MS);\r\n    }\r\n    vTaskDelete(NULL);\r\n}\r\n\r\nvoid app_main()\r\n{\r\n    // If I comment out line below code does not crash\r\n    button_handle_t btn_handle = iot_button_create(BUTTON_A_PIN, BUTTON_ACTIVE_LEVEL);\r\n    xTaskCreatePinnedToCore(dummy_task, \"Dummy\", 2048, NULL, 1, NULL, 1);\r\n}\r\n```\r\n\r\nI have tried compiling with the system esp-idf which is the latest as of today:\r\n\r\n```\r\n~/esp/esp-idf $  git log -1 --oneline\r\n6c44fc70 Merge branch 'feature/gpio_add_hold_support' into 'master'\r\n```\r\n```Makefile\r\nPROJECT_NAME := m5stack-iot-button\r\ninclude $(IDF_PATH)/make/project.mk\r\n```\r\n\r\nI have also tried compiling with the esp-idf which comes as a submodule in esp-iot-solution:\r\n\r\n```\r\n~/esp/esp-iot-solution/submodule/esp-idf $git log -1 --oneline\r\n391c3ff9 Merge branch 'feature/btdm_add_compile_version' into 'master'\r\n```\r\n```Makefile\r\nPROJECT_NAME :=m5stack-iot-button\r\n#If IOT_SOLUTION_PATH is not defined, use relative path as default value\r\nIOT_SOLUTION_PATH ?= $(abspath $(shell pwd)/../../)\r\ninclude $(IOT_SOLUTION_PATH)/Makefile\r\ninclude $(IDF_PATH)/make/project.mk\r\n```\r\n\r\nIf I comment out the call to `iot_button_create()` program starts to work and I get the log output in the serial console.\r\n\r\n```c\r\nvoid app_main()\r\n{\r\n    //button_handle_t btn_handle = iot_button_create(BUTTON_A_PIN, BUTTON_ACTIVE_LEVEL);\r\n    xTaskCreatePinnedToCore(dummy_task, \"Dummy\", 2048, NULL, 1, NULL, 1);\r\n}\r\n```\r\n\r\n```\r\nI (90400) main: My name is Mud.\r\nI (91400) main: My name is Mud.\r\nI (92400) main: My name is Mud.\r\n```\r\n\r\nAs a sidenote, after flashing with the broken binary the board becomes semi bricked. While the broken binary is still running, approximately 9 our of 10 reflashing attempts fail.\r\n\r\n```\r\n$ make flash\r\nFlashing binaries to serial port /dev/cu.SLAB_USBtoUART (app at offset 0x10000)...\r\nesptool.py v2.3.1\r\nConnecting........__\r\nChip is ESP32D0WDQ6 (revision 1)\r\nFeatures: WiFi, BT, Dual Core\r\nUploading stub...\r\nRunning stub...\r\nStub running...\r\nConfiguring flash size...\r\nAuto-detected Flash size: 4MB\r\nFlash params set to 0x0220\r\nCompressed 19696 bytes to 11646...\r\nWrote 19696 bytes (11646 compressed) at 0x00001000 in 1.0 seconds (effective 153.0 kbit/s)...\r\n\r\nA fatal error occurred: Timed out waiting for packet header\r\nmake: *** [flash] Error 2\r\n```\r\n\r\nAfter successfully flashing with working binary which does not contain `iot_button_create()` call, all subsequent flashing attempts are successful again. \r\n\r\nI am not sure whether this is an user error, hardware error or a version mismatch. All testing is done with the grey [MPU9250 M5Stack](http://www.m5stack.com/)."},"comment":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/comments/387492144","html_url":"https://github.com/espressif/esp-idf/issues/1857#issuecomment-387492144","issue_url":"https://api.github.com/repos/espressif/esp-idf/issues/1857","id":387492144,"user":{"login":"evanevery","id":6921804,"avatar_url":"https://avatars1.githubusercontent.com/u/6921804?v=4","gravatar_id":"","url":"https://api.github.com/users/evanevery","html_url":"https://github.com/evanevery","followers_url":"https://api.github.com/users/evanevery/followers","following_url":"https://api.github.com/users/evanevery/following{/other_user}","gists_url":"https://api.github.com/users/evanevery/gists{/gist_id}","starred_url":"https://api.github.com/users/evanevery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanevery/subscriptions","organizations_url":"https://api.github.com/users/evanevery/orgs","repos_url":"https://api.github.com/users/evanevery/repos","events_url":"https://api.github.com/users/evanevery/events{/privacy}","received_events_url":"https://api.github.com/users/evanevery/received_events","type":"User","site_admin":false},"created_at":"2018-05-08T18:09:18Z","updated_at":"2018-05-08T18:09:18Z","author_association":"NONE","body":"This is not going to be particularly encouraging, but...\r\n\r\nI had two ESP8266 4-Relay boards that I got into a similar fashion and could never recover them no matter what I tried.  After many hours of screwing around I just bought a couple of raw ESP8266 modules for less than $5ea and reflowed them onto the PCB.  Boom! Fixed.  Never did resolve that.  Even the PCB manufacturer was at a loss...\r\n\r\n...and yes, I know this is not an option with the M5Stack...  Just a datapoint for perspective...."}}
{"actor":{"display_login":"evanevery"}}