{"id":29716399,"url":"https://github.com/import-tiago/drizzlingbytes","last_synced_at":"2026-05-15T18:02:48.809Z","repository":{"id":149641563,"uuid":"499315477","full_name":"import-tiago/DrizzlingBytes","owner":"import-tiago","description":"DrizzlingBytes is a way to provide over-the-air (OTA) device firmware update (DFU) for MSP430-based systems using ESP32.","archived":false,"fork":false,"pushed_at":"2023-08-20T20:35:34.000Z","size":23301,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-02T13:58:20.946Z","etag":null,"topics":["dfu","dfu-programmer","esp32","firebase","firebase-storage","microcontrollers","msp430","ota","ota-update"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/import-tiago.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}},"created_at":"2022-06-02T23:02:10.000Z","updated_at":"2023-08-19T22:21:32.000Z","dependencies_parsed_at":"2023-07-22T01:05:57.542Z","dependency_job_id":null,"html_url":"https://github.com/import-tiago/DrizzlingBytes","commit_stats":null,"previous_names":["import-tiago/drizzlingbytes"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/import-tiago/DrizzlingBytes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/import-tiago%2FDrizzlingBytes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/import-tiago%2FDrizzlingBytes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/import-tiago%2FDrizzlingBytes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/import-tiago%2FDrizzlingBytes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/import-tiago","download_url":"https://codeload.github.com/import-tiago/DrizzlingBytes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/import-tiago%2FDrizzlingBytes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000775,"owners_count":26082906,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dfu","dfu-programmer","esp32","firebase","firebase-storage","microcontrollers","msp430","ota","ota-update"],"created_at":"2025-07-24T06:10:38.000Z","updated_at":"2025-10-09T02:41:22.739Z","avatar_url":"https://github.com/import-tiago.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"DrizzlingBytes is a way to provide over-the-air (OTA) device firmware update (DFU) for MSP430-based systems.\r\n\r\nIn this implementation, an ESP32 (SoC) acts as a Hosting Device, managing and downloading new firmware available from Firebase Storage and then programming the target MSP430 (MCU).\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/Overview.png\" \u003e\u003c/p\u003e\r\n\r\nAccess to the target's embedded memory is via the Bootstrap Loader (BSL), sometimes just called a \"bootloader\", available natively on MSP430 microcontrollers.\r\n\r\nThe MSP430 bootstrap loader does not start automatically; a special sequence is required on the RST/NMI and TEST pins, and then, a serial communication to the target becomes available through BSL. The entire process for using this feature can be found in Texas Instruments [SLAA096B](https://github.com/import-tiago/DrizzlingBytes/blob/main/Hardware/1.%20Datasheets/MSP430%20BSL/Application%20of%20Bootstrap%20Loader%20in%20MSP430%20With%20Flash%20Hardware%20and%20Software%20Proposal%20(SLAA096B).pdf) documentation, used as a reference in this implementation.\r\n\r\nBriefly, the process is as follows:\r\n\r\nPut the MSP430 in Bootstrap Loader mode by the following invocation process:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/BSLModeInvocation.png\" \u003e\u003c/p\u003e\r\n\r\nFrom this point, the target is ready to communicate with the host. There are two ways to do this: from I2C or UART protocols. In this case, UART is the choice. The necessary settings for the peripheral are:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/BSLUARTSettings.png\" \u003e\u003c/p\u003e\r\n\r\nAnd then writing the BSL commands as needed. The possibilities are:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/BSLCommandsList.png\" \u003e\u003c/p\u003e\r\n\r\nAll commands must be transmitted according to the BSL protocol shown below:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/BSLProtocol.png\" \u003e\u003c/p\u003e\r\n\r\nThen, after performing the desired memory accesses, set the target to normal mode operation again, exiting BSL mode:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/NormalModeInvocation.png\" \u003e\u003c/p\u003e\r\n\r\nAll tests and validations were performed with the following circuit:\r\n\r\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Hardware/0.%20Project/DrizzlingBytes.pdf\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/SchematicPreview.png\"  title=\"Schematic Preview\" alt=\"PDF Download\"\u003e\u003c/a\u003e\u003c/p\u003e\r\n\r\nAs shown in the schematic above, the target MSP430 used for testing is an [MSP430FR4133](https://github.com/import-tiago/DrizzlingBytes/blob/main/Hardware/1.%20Datasheets/MSP430%20BSL/Datasheet%20-%20MSP430FR413x%20Mixed-Signal%20Microcontrollers%20(Rev.%20F).pdf). In order to have a clear visual representation of whether or not the target firmware has been updated, two firmware versions have been pre-compiled: [Slow_Blinky](https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/Precompiled%20Firmware/Slow_Blinky/firmware.txt) and [Fast_Blinky](https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/Precompiled%20Firmware/Fast_Blinky/firmware.txt).\r\n\r\nThe source code used to produce these files can be viewed below and [Code Composer Studio](https://www.ti.com/tool/CCSTUDIO) was used has Integrated Development Environment (IDE).\r\n\r\n```c\r\n#include \u003cmsp430.h\u003e\r\n\r\n#define FAST 100000\r\n#define SLOW 1000000\r\n#define LED BIT7\r\n\r\nvoid main(void) {\r\n    WDTCTL = WDTPW | WDTHOLD;\r\n\r\n    P2OUT \u0026= ~LED;\r\n    P2DIR |= LED;\r\n\r\n    PM5CTL0 \u0026= ~LOCKLPM5;\r\n\r\n    while (1) {\r\n        P2OUT ^= LED;\r\n        __delay_cycles(SLOW);\r\n    }\r\n}\r\n```\r\n\r\nThe version that makes the LED blink slowly was flashed to the MCU and the version that makes it blink faster was uploaded in Firebase Storage. That way, if the ESP32 is able to successfully download and update the target, it will be easily noticeable by the blinky frequency of the LED.\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/FirebaseStorage.png\" \u003e\u003c/p\u003e\r\n\r\nOnce the circuit is powered up, the ESP32 downloads the firmware from Firebase and starts the MSP430 programming process. The result of the BSL invocation as well as the periods of each pulse can be seen below:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/BSLInvocationSignals.png\" \u003e\u003c/p\u003e\r\n\r\nIf all goes well, the communication between HOST and TARGET can be seen through the UART ([Docklight](https://docklight.de/) used as serial terminal):\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/ESP32_Tx.png\" \u003e\u003c/p\u003e\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/ESP32_Rx.png\" \u003e\u003c/p\u003e\r\n\r\nOrganizing and synchronizing the submissions and responses between the parties for better visualization, we have:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/UARTCommunicationSync.png\" \u003e\u003c/p\u003e\r\n\r\nThe assembled circuit used for the tests:\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/import-tiago/DrizzlingBytes/blob/main/Assets/Breadboard.png\" \u003e\u003c/p\u003e\r\n\r\n### Simplified Code Example\r\nThis is a simplified code snippet to show the main functions of the MSP430 library from the Drizzling Bytes project. Check the [/Examples](https://github.com/import-tiago/DrizzlingBytes/tree/main/Examples/) directory for a complete implementation.\r\n```cpp\r\n#define CLOUD_FIRMWARE_ADDRESS \"new/firmware.txt\"\r\n#define SPIFFS_FIRMWARE_ADDRESS \"download/firmware.txt\"\r\n\r\nMSP430 BSL(ESP32_GPIO_RESET_PIN, ESP32_GPIO_TEST_PIN, Serial2, SPIFFS_FIRMWARE_ADDRESS);\r\n\r\nFirebaseStorage OTA(STORAGE_BUCKET_ADDRESS, FIREBASE_FIRMWARE_ADDRESS, SPIFFS_FIRMWARE_ADDRESS);\r\n\r\nvoid setup() {\r\n\tOTA.download_firmware_and_store_in_spiffs();\r\n\r\n\tBSL.load_firmware_from_spiffs();\r\n\r\n\tBSL.invoke_target_bsl_mode_operation();\r\n\r\n\tBSL.write_default_password();\r\n\r\n\tBSL.write_firmware();\r\n\r\n\tBSL.invoke_target_normal_mode_operation();\r\n}\r\n```\r\n\r\n### Contributing\r\n0. Give this project a :star:\r\n1. Create an issue and describe your idea.\r\n2. [Fork it](https://github.com/import-tiago/DrizzlingBytes/fork).\r\n3. Create your feature branch (`git checkout -b my-new-feature`).\r\n4. Commit your changes (`git commit -a -m \"Added feature title\"`).\r\n5. Publish the branch (`git push origin my-new-feature`).\r\n6. Create a new pull request.\r\n7. Done! :heavy_check_mark:\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimport-tiago%2Fdrizzlingbytes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimport-tiago%2Fdrizzlingbytes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimport-tiago%2Fdrizzlingbytes/lists"}