{"action":"created","issue":{"url":"https://api.github.com/repos/jgromes/LoRaLib/issues/44","repository_url":"https://api.github.com/repos/jgromes/LoRaLib","labels_url":"https://api.github.com/repos/jgromes/LoRaLib/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/jgromes/LoRaLib/issues/44/comments","events_url":"https://api.github.com/repos/jgromes/LoRaLib/issues/44/events","html_url":"https://github.com/jgromes/LoRaLib/issues/44","id":353713090,"node_id":"MDU6SXNzdWUzNTM3MTMwOTA=","number":44,"title":"ESP32 Flash Corrupt ?","user":{"login":"BBBits","id":6020029,"node_id":"MDQ6VXNlcjYwMjAwMjk=","avatar_url":"https://avatars0.githubusercontent.com/u/6020029?v=4","gravatar_id":"","url":"https://api.github.com/users/BBBits","html_url":"https://github.com/BBBits","followers_url":"https://api.github.com/users/BBBits/followers","following_url":"https://api.github.com/users/BBBits/following{/other_user}","gists_url":"https://api.github.com/users/BBBits/gists{/gist_id}","starred_url":"https://api.github.com/users/BBBits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BBBits/subscriptions","organizations_url":"https://api.github.com/users/BBBits/orgs","repos_url":"https://api.github.com/users/BBBits/repos","events_url":"https://api.github.com/users/BBBits/events{/privacy}","received_events_url":"https://api.github.com/users/BBBits/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-24T09:36:31Z","updated_at":"2018-08-24T12:16:28Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nI've been working with a modified version of Sandeep Mistry's Lora Lib in Arduino.\r\nI have a Number of these modules in various flavors of my project.\r\nhttps://www.aliexpress.com/item/TTGO-LORA-SX1278-ESP32-0-96OLED-16-Mt-bytes-128-Mt-bit-433Mhz-for-arduino/32824209385.html\r\nMy application now needs a faster response time so decided to try your fsk lib .\r\nI compiled this sketch and blindly uploaded it to three modules.\r\n```c++\r\n#include <LoRaLib.h>\r\nSX1278 fsk = new LoRa;\r\nint state ;\r\nuint32_t cnt = 0;\r\nchar dat[100];\r\nsize_t l;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  Serial.print(F(\"Initializing ... \"));\r\n  state = fsk.beginFSK();\r\n  if (state == ERR_NONE) {\r\n    Serial.println(F(\"success!\"));\r\n  } else {\r\n    Serial.print(F(\"failed, code \"));\r\n    Serial.println(state);\r\n    while (true);\r\n  }\r\n  state = fsk.setFrequency(433.5);\r\n  state = fsk.setBitRate(100.0);\r\n  state = fsk.setFrequencyDeviation(10.0);\r\n  state = fsk.setRxBandwidth(250.0);\r\n  state = fsk.setOutputPower(10.0);\r\n  state = fsk.setCurrentLimit(100);\r\n  uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67, \r\n                        0x89, 0xAB, 0xCD, 0xEF};\r\n  state = fsk.setSyncWord(syncWord, 8);\r\n  if (state != ERR_NONE) {\r\n    Serial.print(F(\"Unable to set configuration, code \"));\r\n    Serial.println(state);\r\n    while (true);\r\n  }\r\n}\r\n\r\nvoid sendmsg(){\r\n\tl= sprintf(dat,\"Msg %d\",cnt);\r\n\tcnt++;\r\n\tprintf(\"Sent %s \\n\",dat);\r\n\tfsk.transmit((uint8_t *)dat,l,0);\r\n}\r\nvoid loop(){\r\n  delay(1000);\r\n  sendmsg();\r\n  do_rcv();\r\n}\r\n\r\n\r\nvoid do_rcv(){\r\n  String str;\r\n  state = fsk.receive(str);\r\n  if (state == ERR_NONE) {\r\n    Serial.println(F(\"Received packet!\"));\r\n    Serial.print(F(\"Data:\\t\"));\r\n    Serial.println(str);\r\n  }\r\n}\r\n\r\n```\r\nThis is what I get from all the devices when connecting to the serial console\r\nrst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)\r\nflash read err, 1000\r\nets_main.c 371\r\n\r\nWhen I try to upload a new firmware to the devices , it fails with this error.\r\nesptool.py v2.1\r\nConnecting.....\r\nChip is ESP32D0WDQ6 (revision 1)\r\nUploading stub...\r\nRunning stub...\r\nStub running...\r\nChanging baud rate to 921600\r\nChanged.\r\nConfiguring flash size...\r\nWarning: Could not auto-detect Flash size (FlashID=0xffffff, SizeID=0xff), defaulting to 4MB\r\nCompressed 8192 bytes to 47...\r\nA fatal error occurred: Timed out waiting for packet content\r\n\r\nI've been programming these modules the same way for over six months .\r\nTotally confused as to what was happening , I decided to put a new flash chip on one of the modules .\r\nI could then upload a new program to that module .\r\nOn the other Lora Lib , I Init like this .\r\n```c++\r\nSPI.begin(5, 19, 27, 18);\r\nLoRa.setPins(18, 14, 26); //LoRa.setPins(SS, RST, DI0);\r\n```\r\nI didn't set any pins in your Lib & suspect that is the reason I am in this situation .\r\nAny thoughts on how I can resolve this problem without swapping out all the Flash chips ?\r\n\r\nRegards\r\nBarry"},"comment":{"url":"https://api.github.com/repos/jgromes/LoRaLib/issues/comments/415741700","html_url":"https://github.com/jgromes/LoRaLib/issues/44#issuecomment-415741700","issue_url":"https://api.github.com/repos/jgromes/LoRaLib/issues/44","id":415741700,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTc0MTcwMA==","user":{"login":"BBBits","id":6020029,"node_id":"MDQ6VXNlcjYwMjAwMjk=","avatar_url":"https://avatars0.githubusercontent.com/u/6020029?v=4","gravatar_id":"","url":"https://api.github.com/users/BBBits","html_url":"https://github.com/BBBits","followers_url":"https://api.github.com/users/BBBits/followers","following_url":"https://api.github.com/users/BBBits/following{/other_user}","gists_url":"https://api.github.com/users/BBBits/gists{/gist_id}","starred_url":"https://api.github.com/users/BBBits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BBBits/subscriptions","organizations_url":"https://api.github.com/users/BBBits/orgs","repos_url":"https://api.github.com/users/BBBits/repos","events_url":"https://api.github.com/users/BBBits/events{/privacy}","received_events_url":"https://api.github.com/users/BBBits/received_events","type":"User","site_admin":false},"created_at":"2018-08-24T12:16:28Z","updated_at":"2018-08-24T12:16:28Z","author_association":"NONE","body":"ok.\r\nPerhaps it was the default SS pin 7 that created the problem on my modules.\r\nAre there esp32 modules that expose GPIO7 ? \r\nI have 0,1,2,3,4,5,12,13,14,15,16,17,18,19,21,22,23,27,26,27,32,33,34,35,36,37,38,39\r\nInterestingly , GPIO7 doesn't have a specific pin definition but GPIO26 can be RTC_GPIO7\r\nalso SD_DATA_0 can be GPIO7 .\r\n\r\nHaven't figured a way round the problem without removing the flash .\r\nI have managed to erase the flash after taking it out & then put it back .\r\nI can then reprogram the normal way .\r\nfound this little utility for a ch341 board that works on win10 \r\nhttps://www.win-raid.com/t796f16-Guide-Using-CH-A-based-programmer-to-flash-SPI-EEPROM-6.html\r\n"}}
{"actor":{"display_login":"BBBits"}}