{"id":18302533,"url":"https://github.com/gemesa/stm32-dc-dc","last_synced_at":"2025-04-05T14:31:35.062Z","repository":{"id":152395567,"uuid":"580082629","full_name":"gemesa/stm32-dc-dc","owner":"gemesa","description":"STM32 based DC-DC converter","archived":false,"fork":false,"pushed_at":"2024-01-06T09:56:34.000Z","size":982,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T06:03:24.569Z","etag":null,"topics":["boost","boost-converter","buck","buck-boost","buck-boost-converter","buck-converter","c","dc-dc","dc-dc-converter","hal","hardware-abstraction-layer","stm32","stm32cubeide","stm32f3","stm32f334","stm32f334c8t6","stm32hal"],"latest_commit_sha":null,"homepage":"https://shadowshell.io/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gemesa.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-12-19T17:13:30.000Z","updated_at":"2025-01-20T08:47:42.000Z","dependencies_parsed_at":"2024-01-16T03:45:41.545Z","dependency_job_id":"b76bd0c8-d35b-485d-852a-1f9a7239f9e5","html_url":"https://github.com/gemesa/stm32-dc-dc","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/gemesa%2Fstm32-dc-dc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemesa%2Fstm32-dc-dc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemesa%2Fstm32-dc-dc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemesa%2Fstm32-dc-dc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gemesa","download_url":"https://codeload.github.com/gemesa/stm32-dc-dc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247352641,"owners_count":20925309,"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":["boost","boost-converter","buck","buck-boost","buck-boost-converter","buck-converter","c","dc-dc","dc-dc-converter","hal","hardware-abstraction-layer","stm32","stm32cubeide","stm32f3","stm32f334","stm32f334c8t6","stm32hal"],"created_at":"2024-11-05T15:20:19.472Z","updated_at":"2025-04-05T14:31:31.782Z","avatar_url":"https://github.com/gemesa.png","language":"C","funding_links":[],"categories":["MCU programming"],"sub_categories":["STM32"],"readme":"# stm32-dc-dc\n\nThis project contains the source code of an [STM32F334C8T6](https://www.st.com/en/evaluation-tools/32f3348discovery.html) based DC-DC converter. The converter can operate in buck, boost and buck-boost (mixed) mode using high resolution timers (HRTIM) and is controlled by a PI controller. The input and output voltages are measured by ADC where the ADC trigger event is synchronized with the duty cycle: the voltages are measured before or after the PWM rising or falling edge (depending on the converter mode and duty cycle), this way the measurement noise can be minimalized.\n\nThe code has been implemented using [STM32CubeIDE](https://www.st.com/en/development-tools/stm32cubeide.html). For more information see the detailed documentation under the pull requests.\n\n## Deployment\n\n### Prerequisites\n\nThe following tools are necessary for building:\n- `make`\n- `arm-none-eabi-gcc`\n\n### How to build\n\nInvoke the following commands:\n\n```bash\n$ cd Debug\n$ make all\n```\n\nwhich will build the _stm32f334c8t6.elf_ binary file (use your preferred method to download it, the SWD interface is configured so it can be used with an [ST-LINK](https://www.st.com/en/development-tools/st-link-v2.html) hardware).\n\nNote: the SW can be built from STM32CubeIDE also (after importing the _.project_ and _.cproject_ files).\n\n## Quickstart\n\nThe DC-DC control is currently disabled in _main.c_:\n\n```c\nvoid vDcDcTask(void const * argument)\n{\n  /* USER CODE BEGIN vDcDcTask */\n\n    uint32_t ulThreadNotification;\n\n    vSetDutyCycleBuck(5000u);\n    vSetAdcTriggerPoint(2500u);\n\n    HAL_HRTIM_WaveformOutputStart(\u0026hhrtim1, HRTIM_OUTPUT_TA1 | HRTIM_OUTPUT_TA2 | HRTIM_OUTPUT_TB1 | HRTIM_OUTPUT_TB2);\n    HAL_HRTIM_WaveformCountStart_IT(\u0026hhrtim1, HRTIM_TIMERID_TIMER_A | HRTIM_TIMERID_TIMER_B);\n\n    HAL_ADCEx_Calibration_Start(\u0026hadc1, ADC_SINGLE_ENDED);\n    HAL_ADCEx_InjectedStart_IT(\u0026hadc1);\n\n    for (;;)\n    {\n        ulThreadNotification = ulTaskNotifyTake(pdTRUE, portMAX_DELAY);\n\n        if (ulThreadNotification)\n        {\n            ulVinRaw = HAL_ADCEx_InjectedGetValue(\u0026hadc1, ADC_INJECTED_RANK_1);\n            ulVoutRaw = HAL_ADCEx_InjectedGetValue(\u0026hadc1, ADC_INJECTED_RANK_2);\n\n            ulVinPhys = ulVinRawToPhys(ulVinRaw);\n            ulVoutPhys = ulVoutRawToPhys(ulVoutRaw);\n\n//            vDcDcControl(ulVoutPhys, 5000u);\n        }\n    }\n\n  /* USER CODE END vDcDcTask */\n}\n```\n\nUncomment the control function and set the chosen output voltage in mV (for example 5000u = 5.00V), then the PI controller will set the desired value. The DC-DC task is activated every 5ms in the current configuration, so it can be made faster if necessary. The PI controller can be tuned further also by changing the P and I constants.\n\n## Results\n\nThe following measurements illustrate the different working modes:\n\n![buck](Measurements/buck.png)\n\n![mixed](Measurements/mixed.png)\n\n![boost](Measurements/boost.png)\n\n## License\n\nThis project contains files from multiple sources with different licenses. The relevant license is added to every source file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemesa%2Fstm32-dc-dc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgemesa%2Fstm32-dc-dc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemesa%2Fstm32-dc-dc/lists"}