{"id":17520518,"url":"https://github.com/jonashoechst/ttgo-lora-sd","last_synced_at":"2025-06-19T22:39:16.212Z","repository":{"id":95253732,"uuid":"161795605","full_name":"jonashoechst/ttgo-lora-sd","owner":"jonashoechst","description":"TTGO LoRa and SD card (working demo)","archived":false,"fork":false,"pushed_at":"2018-12-14T14:36:12.000Z","size":94,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T16:09:29.293Z","etag":null,"topics":["esp32","lora","platformio","sd-card","ttgo"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonashoechst.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":"2018-12-14T14:32:00.000Z","updated_at":"2024-07-10T00:31:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe667427-384c-43cc-ab8d-ab1fd349900c","html_url":"https://github.com/jonashoechst/ttgo-lora-sd","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/jonashoechst%2Fttgo-lora-sd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashoechst%2Fttgo-lora-sd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashoechst%2Fttgo-lora-sd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonashoechst%2Fttgo-lora-sd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonashoechst","download_url":"https://codeload.github.com/jonashoechst/ttgo-lora-sd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250468270,"owners_count":21435452,"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":["esp32","lora","platformio","sd-card","ttgo"],"created_at":"2024-10-20T11:23:37.603Z","updated_at":"2025-04-23T16:09:36.533Z","avatar_url":"https://github.com/jonashoechst.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TTGO LoRa + SD Card\n\nThe TTGO LoRa boards have some issues when using together with SD cards. Both the SX1278 and SD cards use SPI as communication bus. SPI is a protocol family can work in many different configurations.\n\n## ESP32: Software and Hardware SPI\n\nThe ESP32 on the TTGO LoRa board has a builtin **hardware SPI** (HSPI) and can also do **virtual / software SPI** (VSPI) through emulation. Also the VSPI busses as well as the HSPI can be routed to **any** of the pins.\n\n![TTGO LoRa Pinout](TTGO-LoRa.jpg)\n\nIn the default configuration both SX1278 and the SD library uses the HSPI and thereby impede each other. \n\n## Using multiple busses\n\nIn order to make the SX1278 and SD card working, two SPI busses need to be used. While experimenting with the board it also became obvious, that the SX1278 is error-prone on the hardware SPI, and did **not** work, when using the SD card on a VSPI.\n\nThe final solution uses the **HSPI** bus for communication with SD and a software SPI for the SX1278. It is also an option to use two seperate software SPI busses.\n\n### SD on rerouted HSPI\n\n```c\n#define SD_CS 23\n#define SD_SCK 17\n#define SD_MOSI 12\n#define SD_MISO 13\n\nSPIClass sd_spi(HSPI);\nsd_spi.begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS);\n\nif (!SD.begin(SD_CS, sd_spi))\n    Serial.println(\"SD Card: mounting failed.\");\nelse \n    Serial.println(\"SD Card: mounted.\");\n``` \n\n### RH95 on VSPI\n\n```c\nRHSoftwareSPI sx1278_spi;\nRH_RF95 rf95(LORA_CS, LORA_IRQ, sx1278_spi);\n\nsx1278_spi.setPins(LORA_MISO, LORA_MOSI, LORA_SCK);\nif (!rf95.init()) \n    Serial.println(\"LoRa Radio: init failed.\");\nelse\n    Serial.println(\"LoRa Radio: init OK!\");\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashoechst%2Fttgo-lora-sd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonashoechst%2Fttgo-lora-sd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonashoechst%2Fttgo-lora-sd/lists"}