{"action":"created","issue":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/2614","repository_url":"https://api.github.com/repos/espressif/esp-idf","labels_url":"https://api.github.com/repos/espressif/esp-idf/issues/2614/labels{/name}","comments_url":"https://api.github.com/repos/espressif/esp-idf/issues/2614/comments","events_url":"https://api.github.com/repos/espressif/esp-idf/issues/2614/events","html_url":"https://github.com/espressif/esp-idf/issues/2614","id":372444143,"node_id":"MDU6SXNzdWUzNzI0NDQxNDM=","number":2614,"title":"[TW#26939] esp32 uart tx random loss 4-7bytes when sending data to esp8266 ","user":{"login":"outermanle","id":34181637,"node_id":"MDQ6VXNlcjM0MTgxNjM3","avatar_url":"https://avatars2.githubusercontent.com/u/34181637?v=4","gravatar_id":"","url":"https://api.github.com/users/outermanle","html_url":"https://github.com/outermanle","followers_url":"https://api.github.com/users/outermanle/followers","following_url":"https://api.github.com/users/outermanle/following{/other_user}","gists_url":"https://api.github.com/users/outermanle/gists{/gist_id}","starred_url":"https://api.github.com/users/outermanle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outermanle/subscriptions","organizations_url":"https://api.github.com/users/outermanle/orgs","repos_url":"https://api.github.com/users/outermanle/repos","events_url":"https://api.github.com/users/outermanle/events{/privacy}","received_events_url":"https://api.github.com/users/outermanle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-10-22T09:04:51Z","updated_at":"2018-10-23T08:42:56Z","closed_at":null,"author_association":"NONE","body":"## Environment\r\n\r\n- Development Kit:      [ESP32-DevKitC]\r\n- Kit version (for WroverKit/PicoKit/DevKitC): [v4]\r\n- Core (if using chip or module): [ESP-WROOM-32D]\r\n- IDF version (3276a1316): \r\n- Development Env:\t\t[Make]\r\n- Operating System:\t\t[Ubuntu]\r\n- Power Supply:         [USB]\r\n\r\n- ESP8266_RTOS_SDK master version (e409678ccc6399a1b1ca4656267f507f6a116fc5)\r\n\r\n## Problem Description\r\nEsp8266 ota throught uart0, which sending by esp32 uart1.\r\nRandom loss data in esp8266 uart_read_bytes, the buffer is 1024, 100% reproduce it.\r\nThe esp8266 firmware size is about 330KB.\r\n\r\nI am not sure it is esp32 uart driver issue or esp8266 driver issue.\r\nI have merge the patch 508fb79a26a9b62e9b3007b98169a2bc2005594d but it doesn't works. @igrr \r\n```\r\n uart: fix uart_tx_wait_idle to wait for fifo empty\r\n\r\nIn some cases, when data was just written into UART FIFO, transmitter\r\nstate could be still zero while the FIFO did contain some data.\r\nThis resulted in uart_tx_wait_idle occasionally returning before all\r\nthe data was sent out.\r\nFix by checking both UART transmitter state and TX FIFO count.\r\n```\r\nI have no oscillocope to captrue the signal.\r\n\r\nuart config \r\n```c\r\n    uart_config_t uart_config = {\r\n        .baud_rate = 115200,\r\n        .data_bits = UART_DATA_8_BITS,\r\n        .parity = UART_PARITY_ODD,\r\n        .stop_bits = UART_STOP_BITS_1,\r\n        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE\r\n    };\r\n```\r\n\r\nAny help will be greatly appreciated.\r\nThanks.\r\n\r\n\r\n### Expected Behavior\r\nNormally works and no data loss in esp8266.\r\n\r\n### Actual Behavior\r\nrandom loss data in esp8266 uart rx.\r\n\r\n### Steps to repropduce\r\n\r\nesp8266 ota throught uart, sending by esp32.\r\n100% reproduce this issue.\r\n\r\n## Debug Logs\r\n\r\n#### 1. esp32 uart1 tx data then wait for esp8266 response and continue.\r\n```c\r\nI (82892) ota: Wrote [1024] bytes-----------tx 1024\r\nI (83102) uart-rx: cmd ret=[ota=1020], len=8 ---- but rx 1020 loss 4 char.\r\nI (83102) uart-rx: buf=[ota=1020] ,ret=[ota], ret_cmd=[1020]\r\nW (83102) ota: ota result=[1020]\r\nE (83102) ota: write=1024, return=1020\r\nE (83102) httpd: esp8266_ota_write error ESP_FAIL!\r\nI (83112) httpd: 0x3ffdabd0   5f 69 74 65 6d 5f 68 61  73 68 5f 6c 69 73 74 2e  |_item_hash_list.|\r\nI (83122) httpd: 0x3ffdabe0   63 70 70 00 00 00 66 61  6c 73 65 20 26 26 20 22  |cpp...false && \"|\r\nI (83132) httpd: 0x3ffdabf0   69 74 65 6d 20 73 68 6f  75 6c 64 20 68 61 76 65  |item should have|\r\n...\r\nI (83692) httpd: 0x3ffdaf70   61 64 61 70 74 65 72 20  68 61 73 20 6e 6f 20 6d  |adapter has no m|\r\nI (83702) httpd: 0x3ffdaf80   65 6d 6f 72 79 0a 00 73  74 61 30 00 54 43 50 49  |emory..sta0.TCPI|\r\nI (83712) httpd: 0x3ffdaf90   50 20 61 64 61 70 74 65  72 20 62 69 6e 64 20 6e  |P adapter bind n|\r\nI (83722) httpd: 0x3ffdafa0   65 74 20 63 61 72 64 20  25 73 20 65 72 72 6f 72  |et card %s error|\r\nI (83732) httpd: 0x3ffdafb0   0a 00 61 70 30 00 00 00  00 00 96 30 07 77 2c 61  |..ap0......0.w,a|\r\nI (83742) httpd: 0x3ffdafc0   0e ee ba 51 09 99 19 c4  6d 07 8f f4 6a 70 35 a5  |...Q....m...jp5.|\r\n```\r\n\r\n#### 2.esp8266 uart0 rx and write flash then respsonse to esp32\r\n This case missing [ bin] 4 char. It should be 'adapter bind' instead of 'adaptend'.\r\n```c\r\nI (82822) ota: Read [1024] bytes\r\nI (82824) ota: total size = 336928, write size 98982, current size = 1024\r\nI (82839) ota: [CRET:{ota=1024};END] ------previos is normal.\r\n\r\nI (83149) ota: Read [1020] bytes  ---- read 1024, but esp32 send 1024! loss 4 char [ bin]\r\nI (83142) ota: total size = 336928, write size 100006, current size = 1020\r\nI (83145) ota: [CRET:{ota=1020};END]\r\nI (85255) slave: 0x40108354   5f 69 74 65 6d 5f 68 61  73 68 5f 6c 69 73 74 2e  |_item_hash_list|\r\nI (85255) slave: 0x40108364   63 70 70 00 00 00 66 61  6c 73 65 20 26 26 20 22  |cpp...false && |\r\nI (85264) slave: 0x40108374   69 74 65 6d 20 73 68 6f  75 6c 64 20 68 61 76 65  |item should hav|\r\n...\r\nI (85819) slave: 0x401086f4   61 64 61 70 74 65 72 20  68 61 73 20 6e 6f 20 6d  |adapter has no |\r\nI (85818) slave: 0x40108704   65 6d 6f 72 79 0a 00 73  74 61 30 00 54 43 50 49  |emory..sta0.TCP|\r\nI (85828) slave: 0x40108714   50 20 61 64 61 70 74 65  6e 64 20 6e 65 74 20 63  |P adaptend net | ------> lost\r\nI (85837) slave: 0x40108724   61 72 64 20 25 73 20 65  72 72 6f 72 0a 00 61 70  |ard %s error..a|\r\nI (85846) slave: 0x40108734   30 00 00 00 00 00 96 30  07 77 2c 61 0e ee ba 51  |0......0.w,a...|\r\nI (85855) slave: 0x40108744   09 99 19 c4 6d 07 8f f4  6a 70 35 a5              |....m...jp5.|\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/comments/432153884","html_url":"https://github.com/espressif/esp-idf/issues/2614#issuecomment-432153884","issue_url":"https://api.github.com/repos/espressif/esp-idf/issues/2614","id":432153884,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjE1Mzg4NA==","user":{"login":"negativekelvin","id":22392044,"node_id":"MDQ6VXNlcjIyMzkyMDQ0","avatar_url":"https://avatars1.githubusercontent.com/u/22392044?v=4","gravatar_id":"","url":"https://api.github.com/users/negativekelvin","html_url":"https://github.com/negativekelvin","followers_url":"https://api.github.com/users/negativekelvin/followers","following_url":"https://api.github.com/users/negativekelvin/following{/other_user}","gists_url":"https://api.github.com/users/negativekelvin/gists{/gist_id}","starred_url":"https://api.github.com/users/negativekelvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/negativekelvin/subscriptions","organizations_url":"https://api.github.com/users/negativekelvin/orgs","repos_url":"https://api.github.com/users/negativekelvin/repos","events_url":"https://api.github.com/users/negativekelvin/events{/privacy}","received_events_url":"https://api.github.com/users/negativekelvin/received_events","type":"User","site_admin":false},"created_at":"2018-10-23T08:42:56Z","updated_at":"2018-10-23T08:42:56Z","author_association":"CONTRIBUTOR","body":"Both will usually use source clock of 80mhz but esp32 has fractional divider and esp8266 has integer divider"}}
{"actor":{"display_login":"negativekelvin"}}