{"id":17008818,"url":"https://github.com/i-e-b/lilygo_tsim_a7670x","last_synced_at":"2025-04-19T18:12:59.642Z","repository":{"id":139825385,"uuid":"598031387","full_name":"i-e-b/LilyGo_Tsim_A7670X","owner":"i-e-b","description":"T-SIM A7670 E development setup, tests, and notes","archived":false,"fork":false,"pushed_at":"2023-07-27T12:14:03.000Z","size":8353,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T11:34:29.512Z","etag":null,"topics":["experimental"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/i-e-b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-06T08:48:56.000Z","updated_at":"2024-11-11T14:52:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"56321a36-315c-452b-b17d-1050295e6db0","html_url":"https://github.com/i-e-b/LilyGo_Tsim_A7670X","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FLilyGo_Tsim_A7670X","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FLilyGo_Tsim_A7670X/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FLilyGo_Tsim_A7670X/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FLilyGo_Tsim_A7670X/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i-e-b","download_url":"https://codeload.github.com/i-e-b/LilyGo_Tsim_A7670X/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249760135,"owners_count":21321843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["experimental"],"created_at":"2024-10-14T05:29:19.516Z","updated_at":"2025-04-19T18:12:59.637Z","avatar_url":"https://github.com/i-e-b.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LilyGo_Tsim_A7670X\nT-SIM A7670 E development setup, tests, and notes\n\n## Recovery\n\nIf the bootloader/code/UART-to-USB get damaged,\nyou can hook up a serial reader to the TX/RX pins,\nthen\n\n1. Press and hold `IO0`\n2. Press and release `RST`\n3. Release `IO0`\n\nThe device should now respond to `esptool` etc, and be programmable.\nResetting the device may set it back to the broken program.\n\n## General notes\n\nNone of the built-in LEDs can be directly flashed by the ESP32 CPU.\n* The red LEDs are under control of the SIMCOM module. They are `NETLIGHT` and `STATUS`.\n* The blue LEDs are under control of the CN3065 charge controller. They are `CHRG` and `STDBY`.\n\nThe *Table of Contents* in the SIMCOM datasheet starts page 20.\n\nThe MAX3232 chip mini-break-out boards introduce a *lot* of noise when you use both sides.\nUse one chip per pair of data lines. (Currently running 3: Serial0, SerialEwc, and CTS/Active flag)\n\nThe antenna connectors are IPex MHF-4 type: https://www.i-pex.com/product/mhf-4\n(the larger screw-on type are SMA type: https://en.wikipedia.org/wiki/SMA_connector )\n\n## Peripheral parts\n\n- 3.0V..40V to 1.5V..35V buck converter (for power supply) https://www.amazon.co.uk/Adjustable-Step-Down-Converter/dp/B08PNV2GXT\n- RS232 level converter break-out board (Ti MAX232 chip) https://www.mikroe.com/max232-board\n- RS232 level converter break-out board (SP3232 chip) https://www.amazon.co.uk/gp/product/B00KM6XD1A/\n- Mini RS232 level converted (knock-off chip) https://www.amazon.co.uk/gp/product/B07XM6RNZG\n\n## SIM setup\n\nI am using a SIM card from https://hologram.io/ , with the Pilot (1MB) plan.\nThe dashboard is at https://dashboard.hologram.io/\n\nBefore trying to connect, your SIM should be 'activated'.\nSee https://dashboard.hologram.io/org/{my-org}/device/{my-device}/status?page=1\nYou should get the message:\n\n```\nYour device is activated and ready for use on our network. We have not yet seen it connect to a local tower or pass data.\n```\n\n## OTA of the ESP32\n\nSee these resources:\n\n* https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/ota.html\n* https://github.com/ayushsharma82/AsyncElegantOTA\n* https://lastminuteengineers.com/esp32-ota-updates-arduino-ide/\n* https://microcontrollerslab.com/esp32-ota-over-the-air-updates-asyncelegantota-library-arduino/\n\n## Useful ESP32 documentation points\n\n* Deep wake stubs - code to run immediately on wake: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/deep-sleep-stub.html\n\n\n# Arduino setup\n\nManufacturer's instructions are at: https://github.com/Xinyuan-LilyGO/T-A7670X\n\n* Get Arduino IDE from https://www.arduino.cc/en/software\n  * Under Linux (Xubuntu), I got the AppImage. Show properties, allow execute as program\n* File -\u003e Preferences; In `Additional boards manager URLS`, add this: `https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json `. If there are other URLs in here, separate with comma (`,`).\n    * This is Espressif's package bundle, for the ESP32 chip (the main CPU)\n\n* Tools -\u003e Boards -\u003e Board Manager... \n    * small box `Filter your search`. Type `esp32`\n    * find `esp32` by Espressif Systems (version 2.0.6 as of writing)\n    * press install. This will download a whole bunch of packages, and takes a while.\n    * ends with `Configuring platform. Platform esp32:esp32@2.0.6 installed` in the 'Output' area.\n\n(note- when you press 'Install' in the Arduino UI, it shows the previous version immediately after starting. This seems to be normal, and the correct version is displayed in output)\n\n* Sketch -\u003e Include Library -\u003e Manage Libraries\n    * `TinyGSM` by Volodymyr Shymanskyy (0.11.5)\n    * `StreamDebugger` by Volodymyr Shymanskyy (1.0.1)\n    * `ArduinoHttpClient` by Arduino (0.4.0; LilyGo recommend https://github.com/ricemices/ArduinoHttpClient ; this README goes with the official Arduino library at https://github.com/arduino-libraries/ArduinoHttpClient . Both options are derived from the same source: https://github.com/amcewen/HttpClient )\n\n* Close and re-open Arduino.\n* Plug in the board using USB-C (the USB micro is for the SIMCOM modem only)\n    * You should get a bright blue light at the centre of the main board immediately\n    * a pair of red lights by the SIMCOM should come up a few seconds later\n    * one of the red lights should start flashing after 10-20 seconds\n    * once the red light is flashing, the Hologram dashboard should update with:\n        `SIM -- LOCAL TOWER -- GLOBAL NETWORK . . INTERNET ACCESS`\n        `Your device is currently connected to our network, or has connected recently to our network and has an open data session`\n\n* Tools -\u003e Board -\u003e esp32 -\u003e ESP32 Wrover Module\n* Tools -\u003e Get Board Info...\n    * If this reports \"Please select a port to obtain board info\", your connection is not working.\n        See \"If you can't connect to the board\" below.\n\n\n## Programming\n\nMake sure everything is powered up and is as described in the notes above\n\n### 01 First program: Local test\n\nThe first program is just here to check we can connect the ESP32 module, run a program on it, and get the result back to the host PC.\n\n`01_HelloWorld.ino`\n\n```c\n#include \"Arduino.h\"\n\nvoid setup() {\n  Serial.begin(115200);\n  delay(100);\n  Serial.println(\"Hello, world!\");\n}\n\nint i = 0;\nvoid loop() {\n  delay(1000);\n  Serial.printf(\"Device is active (%d) \\r\\n\", i++);\n}\n```\n\n* Verify this. There should be no errors.\n* Switch to Serial Monitor ( Tools -\u003e Serial Monitor ), and ensure the '... baud' drop-down menu says *exactly* `115200 baud`.\n* Press the upload button, or Sketch -\u003e Upload\n* There should be some compiler output. Any errors or red text, see Errors section below\n* Switch to Serial Monitor. You should see `Device is active (...)` with numbers increasing every second.\n\nNote: The red LEDs next to the SIMCOM module will go out when the device resets after programming.\nThe default program which wakes up the modem will be overwritten by our test code. We will get it\nback soon.\n\nIf you see the correct output, move on to next test program.\n\n### 02 Ping the modem\n\nThis program tests the connection between the ESP32 (main CPU module) and the SIMCOM (cellular modem module)\n\n`02_HelloModem.ino`\n\nUpload and check the serial monitor. You should get the message `The SIMCOM A7670 Module replied OK to attention command. Looks good.` after some test data.\n\n### 03 Modem library\n\nThis program uses the built-in SIMCOM HTTP client to contact an external server, and send\u0026receive data.\n\n`03_modem_library.ino`\n\n**Before running:** Check the constants at the top of the program file.\nUpload and run. Each time the program is run, the API will be called.\nCheck the HTTP server to make sure the call is correctly formatted.\nThe Serial console should be written with the response from the HTTP server.\n\nThis will use some of your data allocation.\n\n## Errors\n\n### Junk in Serial Monitor\n\n**Diagnosis:** scrabled output in serial monitor in the Arduino IDE. Looks like \n```\nRBa#�!.ʭ␁����ń�!�i��B�sV҆��*␘F�TRB�Cac�I�!C����9�\n```\nor similar junk.\n\n**Cause:** Wrong 'baud' rate.\n\n**Fix:** Make sure that your code `Serial.begin()` and the 'baud' drop down in the serial monitor have the identical value.\nThe serial monitor does **not** update existing data when the drop-down is changed.\nPress the `RST` (reset) button on the device once settings are correct.\n\n### No permission to write to USB\n\n**Diagnosis:** `A fatal error occurred: Could not open /dev/{your port}, the port doesn't exist` when you try to upload.\n\n**Cause:** User does not have permission to write to USB serial (Linux)\n\n**Resource:** https://askubuntu.com/questions/899374/arduino-only-works-in-root\n\n**Fix:** Add yourself to the `dialout` group, or add a `udev` rule.\n\n```\nsudo usermod -a -G dialout $USER\n```\n(note: this must be run with `sudo` when logged in as the normal user, and **not** as the root user)\n\nNow either log-out or reboot machine (restarting Arduino doesn't work?)\n\nIf you try to write a `udev` rule, `hardinfo` will give you the vendor and product IDs\n\n### Protocol error\n\n**Diagnosis:** `OSError: [Errno 71] Protocol error` when you try to upload code\n\n**Cause:** Wrong USB device, or wrong board type.\n\n**Fix:**\nTry unplugging board, and see what port disappears. That's the right port.\n\nIf still broken, might be a faulty USB cable, RF interference or magnets near the cable, or some other problem.\n\nTry running `dmesg` or `journalctl -k` while doing an upload, look for any USB issues.\n\n### No module named 'serial'\n\n**Diagnosis:** `ModuleNotFoundError: No module named 'serial'` when you try to verify the code.\n\n**Cause:** Missing Python modules (python is used in cross-compiler workflow)\n\n**Fix:** In a terminal:\n\n```\n pip3 install pyserial\n```\n\nif you get an error that `pip3` is not found, install Python version 3.\nOn Linux:\n\n```\nsudo apt install python3-pip\n```\n\n### If you can't connect to the board\n\n**Diagnosis:** At the bottom-right of the Arduino window, it says\n\n```\nESP32 Wrover Module [not connected]\n```\n\n**Cause:** The board is not connected, or there is a fault in the USB system.\n\n**Resources:** https://support.arduino.cc/hc/en-us/articles/4412955149586-If-your-board-is-not-detected-by-Arduino-IDE\n\n`sudo apt install hardinfo`\n`sudo hardinfo`\nDevices -\u003e USB Devices\nLook for unknown.\nIf nothing, USB cable might be damaged, or a bad usb port on PC?\nWhen working, it should have `QinHeng Electronics USB Single Serial`\n\n**Fix:** Test device in different USB ports, avoid using a hub. Try different cables.\n\n# VSCode + Platform IO set-up\n\n* The \"PlatformIO\" IDE installer is at: https://platformio.org/platformio-ide\n    * this is VSCode with a plug-in\n    * Installed from deb package at https://code.visualstudio.com/docs/?dv=linux64_deb (main download page at https://code.visualstudio.com/ )\n\nIn VSCode:\n* File -\u003e Preferences -\u003e Extensions\n* Search for `PlatformIO` and install\n* Once installed, it should show a screen with a button \"Install PlatformIO Core\". Press this button.\n* When this is finished, it will prompt you to restart VSCode. Do this.\n* You should have a new icon-button on the left of VSCode window. Looks like an Alien head.\n    * This should have a link to \"PIO Home\", where you can do more set-up and create or load projects.\n\n* The PlatformIO tools will be using the Arduino compiler tooling under the hood, so make sure the Arduino setup is done\n* Make sure you create at least one project before loading existing ones.\n    * The first project creation takes a while, and will download the required tooling.\n\nWhen creating a new project:\n- **Name:** the new project name. Use characters [a-z0-9_-], no spaces or caps. PlatformIO can be fussy.\n- **Board:** `Espressif ESP32 Dev Module`\n- **Framework:** Arduino\n- **Location:** Storage location. Use characters [a-z0-9_-], no spaces or caps. PlatformIO can be fussy.\n\n## Building and uploading\n\n* Open the PlatformIO try, using the Alien head icon\n* Under `Project Tasks` \u003e `esp32dev` \u003e `General`\n    * Find the lines `Build` and `Upload and Monitor`\n    * Press either of these line once to trigger the action\n\n## Code formatting\n\nOther than the various settings and library documents, the code is the same between *Arduino IDE* and *PlatformIO IDE*.\n\n# CLion + Platform IO set-up\n\nManufacturer's instructions are at: https://github.com/Xinyuan-LilyGO/T-A7670X\n\n* Make sure that CLion is installed (using JetBrains Toolbox, or via https://www.jetbrains.com/clion/ )\n    * Add the PlatformIo plugin ( https://plugins.jetbrains.com/plugin/13922-platformio-for-clion )\n        * (there is also https://plugins.jetbrains.com/plugin/11284-openocd--esp32-support-for-embedded-development , but not looking at that now )\n    * PlatformIO CLion docs are at: https://docs.platformio.org/en/latest/integration/ide/clion.html\n    * We will be using the Arduino compiler tooling for CLion projects, so make sure the Arduino setup is done\n\n* To create a PlatformIO project\n    1. In CLion, File -\u003e New -\u003e Project...\n    2. Select [Embedded] PlatformIO\n\n**NOTE:** The CLion integration for PlatformIO seems to be full of issues and work-arounds.\nhttps://docs.platformio.org/en/latest/integration/ide/clion.html\n\nGoing to try the VSCode integration before looking into CLion.\n\n# T-SIM 7670E ESP config\n\n```\nCONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html\nPLATFORM: Espressif 32 (6.0.1) \u003e Espressif ESP32 Dev Module\nHARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash\nAVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa\nCURRENT: upload_protocol = esptool\nChip is ESP32-D0WD-V3 (revision v3.0)\nFeatures: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None\nCrystal is 40MHz\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Flilygo_tsim_a7670x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi-e-b%2Flilygo_tsim_a7670x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Flilygo_tsim_a7670x/lists"}