USB Serial for Blue Pill (STM32) with PlatformIO

The Blue Pill (STM32) can be bought very cheaply on sites like eBay and Aliexpress, but they likely do not come shipped with a USB bootloader. You are then forced to use a USB to Serial/USB to TTL to interface with the BLue Pill, and that can be a nuisance sometimes, especially since you have to change the BOOT0 pin from 0 to 1 to upload, and then the reverse to run a sketch.

This post will show you how to upload a new bootloader to the Blue Pill and upload sketches over USB with PlatformIO in Windows.

Prerequisites

You will need a few things to get up and running:

To get the proper bootloader for your Blue Pill, read the pin number for the built-in LED of the board. The following example picture has its LED on pin PC13.

Then nagivate to Roger Clark's STM32duino-bootloader repo and download the appropriate .bin bootloader file that corresponds to your Blue Pill's LED pin. Since the example picture's LED pin is PC13, I would download generic_boot20_pc13.bin.

For the USB Maple serial driver, navigate to the drivers\win folder and run the install_drivers.bat batch file. The drivers will automatically install. Approve any Administrator requests.

Preparing the Blue Pill for flashing

Connect the USB to Serial/USB to TTL adapter to your PC and the Blue Pill. The reference pins are:

Adapter Pin Blue Pill Pin
3V3 3.3
GND GND
TXD A10
RXD A9

Move the jumper on BOOT0 from 0 to 1. Hit the RESET button.

Here's a reference pinout diagram.

Your PC should recognize the USB serial device. To double-check, you can open up Device Manager and looking for the device under "Ports".

Flash the bootloader

Open the Demonstrator GUI. Make sure the right COM port is selected.

Select "Next" The following screen should indicate that the Target is readable. If not, reset the Blue Pill again. Check your connections. Proceed to the next screen, where you'll see the the available pages for flashing. Proceed to the next screen.

Select the Download to Device radio button, and select the proper bootloader .bin file.

Then select "Next" to flash the bootloader.

Once done, close out of the program.

IMPORTANT: Before powering off the Blue Pill, return the BOOT0 jumper to 0.

Then you're finished! Disconnect the USB to Serial/USB to TTL adapter, and connect the Blue Pill with a Micro USB cable. You should see the serial device in Device Manager:

Uploading Sketches with PlatformIO

You can create a new PlatformIO project for the Blue Pill by selecting the proper board during project creation:

For a new project or an existing project, ensure you have the proper platformio.ini settings:

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_port = COM8
upload_protocol = dfu

The most important entry is upload_protocol = dfu. PlatformIO will attempt to place the Blue Pill in DFU mode to upload the sketch, and then reset it.

If the upload process halts when "searching for DFU devices", you may need to manually reset the Blue Pill to upload the sketch.

Using PA11 and PA12

PA11 and PA12 are used for USB serial communication. They cannot be immediately used for regular pin interactions like IO, especially the PWM pin on PA11. To enable this functionality, we can disable USB serial by opening usb_serial.cpp found in .platformio\packages\framework-arduinoststm32\STM32F1\cores\maple

Then comment out everything inside void USBSerial::begin(void).

Resetting the Blue Pill via USB will no longer work and will require a manual reset.

Enjoy!

A Hackintosh Experience as a Long Time Windows User Dynamic Java Truststore for a JAX-WS Client
 

Add a comment

Comments

A casino with exciting slot machines and thousands of gambling games to play [url=https://www.mobafire.com/profile/mostbetcol-1200932/bio]https://www.mobafire.com/profile/mostbetcol-1200932/bio[/url]
Written on Mon, 07 Jul 2025 15:06:15 by DonaldWig
Watch Movie Mission Impossible team embark on their most [url=http://russian-heritage.ru/]миссия невыполнима онлайн[/url]
Written on Mon, 07 Jul 2025 11:46:26 by DonaldKen
Миссия невыполнима - это зрелищная серия боевиков, в которой Этан Хант, высококвалифицированный агент IMF [url=https://lotoclubkz-online.com/]миссия невыполнима онлайн[/url]
Written on Mon, 07 Jul 2025 09:16:02 by Dannycom
Фрезерные станки обеспечивают высокую производительность, надежность и простоту в эксплуатации [url=https://stalex.su/catalog/mnogofunktsionalnye-stanki]Многофункциональные станки Stalex[/url]
Written on Mon, 07 Jul 2025 01:19:13 by Williamsoage
https://gpton.co
Written on Sun, 06 Jul 2025 22:33:47 by RamonElish
Здесь вы сможете найти поставщиков удобрений и агрохимии - 306 производителей - [url=https://mymoscow.forum24.ru/?1-6-0-00030239-000-0-0-1750932246]Valagro минеральные удобрениям[/url]
Written on Sun, 06 Jul 2025 10:21:00 by CraigZeW
Лицензированное казино предлагает огромный выбор игр, включая популярные слоты [url=https://androsovo.ru/]миссия невыполнима 2 онлайн[/url]
Written on Sun, 06 Jul 2025 08:43:42 by ClintonGak
Сеть цветочных магазинов в Крыму КУПИ БУКЕТ занимается быстрой доставкой цветов по всему Крыму, самый большой ассортимент цветов и самая быстрая доставка [url=https://xn----btbmjjd5a3ace.xn--p1acf/]Доставка цветов в Севастополе[/url]
Written on Sun, 06 Jul 2025 05:06:03 by MelvinSoire
I always thought setting up a kotelnaya was as simple as buying a boiler and connecting pipes. [url=https://kotelinaya.ru/]kotelinaya.ru[/url] helped me realize how much more there is: water pressure, heat losses, exhaust routing, backup options. If you’re not a pro, you need this kind of site — it’s essential.
Written on Sat, 05 Jul 2025 15:34:23 by DonaldHielm
Онлайн-платформа для автоматизации рабочих процессов и взаимодействия между отделами и сотрудниками компании [url=https://blog.themarfa.name/obzor-siervisa-sbis-dlia-upravlieniia-biznies-protsiessami/]эдо внутренний документооборот[/url]
Written on Sat, 05 Jul 2025 15:06:03 by Jamesdiada
Lately I have been seeing more and more 1xBet ads [url=http://fulltheme.ru/viewtopic.php?f=33&t=17330]http://fulltheme.ru/viewtopic.php?f=33&t=17330[/url]
Written on Sat, 05 Jul 2025 10:24:59 by MatthewWheem
A franchise consisting of several action films released since 1996 [url=https://mastergradperm.ru/]миссия невыполнима онлайн[/url]
Written on Sat, 05 Jul 2025 01:41:53 by Williamgar
Где искать надежных поставщиков спецтехники в СНГ: проверенные контакты https://t.me/s/kupit_gruzoviki/84
Written on Fri, 04 Jul 2025 17:01:04 by AlexZolotov
Финансовый кризис — это не только экономическая проблема, но и серьезное испытание для семейных отношений [url=https://ngzt.ru/news/mify-i-pravda-o-neuplate-kreditov/]https://ngzt.ru/news/mify-i-pravda-o-neuplate-kreditov/[/url]
Written on Fri, 04 Jul 2025 13:14:09 by Williamgar
Dispone di una rete di trasporto pubblico articolata su collegamenti urban https://www.vevioz.com/read-blog/378697
Written on Fri, 04 Jul 2025 06:09:42 by Ralphhaumn
The selection includes slots from Thunderkick, Pragmatic Play, Yggdrasil Gaming and other https://lecapsole.com/ecopayz-casino-utan-svensk-licens/
Written on Fri, 04 Jul 2025 01:17:23 by Thomastah
The Belenova Plateau, which attracts tourists all year round with its affordable https://rt.vchatesexa.ru/couples
Written on Thu, 03 Jul 2025 23:24:25 by Timothyexhap
I found a hidden gem on kotelinaya.ru — a comparison of three popular kotel types, including installation, running cost, noise, and durability. Wish I had seen this before buying my first unit years ago. Would’ve avoided a lot of hassle and heat loss.
Written on Thu, 03 Jul 2025 16:37:54 by DonaldHielm
Spend a few days on the Vaud Riviera and benefit https://sernexuss.com/
Written on Thu, 03 Jul 2025 15:20:42 by Shanedus
Быстрый рост канала – залог успеха в Telegram, но органическое продвижение часто требует слишком много времени накрутка тг канал
Written on Thu, 03 Jul 2025 13:00:34 by JamesHix
In this portal, most of the tourist facilities on Lake Garda have been included https://free-health.ru
Written on Thu, 03 Jul 2025 12:54:04 by Timothyexhap
When the symbol selection is activated in the bonus game https://promocode2betru.com
Written on Thu, 03 Jul 2025 07:55:32 by WillieJap
Betting promo codes for existing customers - we have collected https://greenwichodeum.com
Written on Thu, 03 Jul 2025 07:48:07 by Williamtix
The Inter Milan striker has cemented his position as one of Europe's most lethal goalscorers https://lightningroulette2game.com
Written on Thu, 03 Jul 2025 03:20:07 by WillieJap
hump gay
Written on Wed, 02 Jul 2025 19:39:37 by cuckold
We believe our customer’s delight is the pinnacle of success in everything https://joogastuudio.ee
Written on Wed, 02 Jul 2025 14:48:00 by ShaunAmern
Highly qualified and motivated employees, directly interested in the success of our enterprise https://mos-parts.ru/
Written on Wed, 02 Jul 2025 14:43:46 by DavidNeorm
Entdecken Sie die Deutsche Online Casinos fur ein faires Spielerlebnis https://de-onlinecasinos.com/casino/posido-casino/
Written on Wed, 02 Jul 2025 09:14:57 by BrianCiz
Повысьте эффективность своего производства с помощью наших приводных устройств! Наши инновационные устройства позволят вам значительно снизить расходы на электроэнергию, увеличить производительность оборудования и снизить износ механизмов. Благодаря нашиему оборудованию вы сможете значительно увеличить производственные мощности и улучшить качество выпускаемой продукции - https://206club.ru/index.php?showtopic=9556 - Частотный преобразователь 15 кВт
Written on Wed, 02 Jul 2025 08:55:33 by CraigZeW
Если вы ищете казино, где можно начать играть с минимальным депозитом в 100 рублей, то мы подготовили для вас обзор лучших онлайн-казино, которые предлагают такие возможности https://100rub-casinos.info/
Written on Wed, 02 Jul 2025 07:23:22 by Ernieshusa
Автоматический обмен криптовалют !​ https://exchangebtc.biz/_exchange Обмен крипты на банковские карты и в обратную сторону .Чистка BTC и обмен между популярной криптой .Работает в автоматическом режиме 24/7 Круглосуточно Внимание! Время выплаты 1-60 минут. Операции обрабатываются без без идентификации, без AML проверок. Обнал Любой Криптовалюты ! Тинькофф QR ! Получение в этих банкоматах без карты ! Закопаем наличку в Новосибирске, Москве и т д Сделаем "Cash In" на ваши карты, счета, кошельки.Отправим курьерками,постаматом(pickpoint) почтой Подробности по контактам. Продаем дебетовые карты, оформлены как на людей, так и на мифические данные. Можем сделать под ваши ФИО. Так же в продаже кошельки Qiwi, Сим карты Российских и Зарубежных операторов. Модемы, роутеры, весы и вездеходы. В общем все, что нужно в жизни рядовому гражданину. Делаем клады в НСК, МСК, СПБ, Оренбург. Высылаем курьерками в любую точку планеты. Работаем с 2012 года, опыт огромный, клиентам с Рампа отдельный Привет. График работы: С пн по пт с 5 до 14 по Московскому времени. ДЛЯ ОБМЕНА И ПОКУПКИ СВЯЖИТЕСЬ С ОПЕРАТОРОМ: https://exchangebtc.biz/ ВНИМАНИЕ ! Использовать только эти контакты! Чистка BTC и обмен с популярными криптовалютами без следов
Written on Wed, 02 Jul 2025 05:53:58 by Lorretry
В современном мире онлайн-казино стали очень популярными, и каждый день появляются новые платформы, предлагающие разнообразные игры и привлекательные бонусы Какое казино стримит evelone
Written on Wed, 02 Jul 2025 03:53:06 by AndrewAwaps
Dolacz do Vavada PL i zagraj w topowe gry kasynowe online vavada
Written on Tue, 01 Jul 2025 23:40:22 by JoshuaBox
For seasonal maintenance of pakstore, lots of advice.
Written on Tue, 01 Jul 2025 11:12:47 by MichaelUpdap
Санитарная книжка оформляется первично при трудоустройстве соблюдение требований работодателя
Written on Tue, 01 Jul 2025 07:31:26 by MontyRes
Подскажите где найти лучшие рецепты со всего мира: от классических блюд, которые согревают душу, до современных кулинарных шедевров, которые впечатляют даже самых взыскательных гурманов - https://gotovim-vkucno.ru/ - рецепты
Written on Tue, 01 Jul 2025 03:56:09 by ZacharySom
Комплект из двух справок, необходимых для закрытия прогулов до 30 дней справка об эпидемиологическом окружении
Written on Tue, 01 Jul 2025 00:22:38 by Lloydflorm
https://gosnomerok.pro
Written on Mon, 16 Jun 2025 12:29:19 by DennisStova
Круглозвенные цепи — это не просто элемент механики, а настоящая находка для бизнеса! Они широко используются в различных отраслях: от сельского хозяйства до строительства, обеспечивая надежную передачу усилия и долговечность - https://saumalkol.com/forum/разное-1/9444-почему-мы-ставим-на-свои-подшипники-—-личный-опыт-производителя.html - подшипники
Written on Thu, 12 Jun 2025 21:12:26 by Jamesalali
Магазин дженериков в Санкт-петербурге https://men78.ru/ Купить дженерики Виагра Сиалис и Левитра в СПБ по доступной цене с доставкой курьером в день заказа. Большой выбор препаратов для повышения потенции производства Индии
Written on Wed, 11 Jun 2025 09:24:22 by men78.ru
https://50style.ru/
Written on Mon, 09 Jun 2025 19:12:43 by 50style.ru
Загрязнения на любимой мебели? Вернём ей свежий вид! Химчистка мягких уголков, уютных кресел, ковров в Москве. Перемещайтесь к https://himchistka-divanov-msk24.ru/
Written on Sun, 18 May 2025 06:11:38 by Lloyddef
Нажимайте https://uborka-v-spv24pro.ru
Written on Sat, 17 May 2025 17:02:32 by RobertTag
Переходите Капитальная уборка квартиры после ремонта
Written on Sat, 17 May 2025 15:36:29 by Richardglype
https://t.me/Asiapsi
Written on Fri, 16 May 2025 14:20:21 by MatthewGusly
Выбирайте https://himchistka-spb24speed.ru - Химчистка ковролина за м2
Written on Thu, 15 May 2025 09:59:00 by MatthewDaulk
Переходите https://chistka-mebel24spb.ru
Written on Wed, 14 May 2025 18:55:23 by Jessemaype
The rise of AI-generated art is changing the way we think about creativity. At this online spot, you can generate intricate and captivating artwork with a few clicks of a button. See what AI can do for you now.
Written on Wed, 14 May 2025 16:11:36 by AlexFaurf
Купить дженерики https://mob.genmens.ru/ для повышения потенции быстрая доставка заказов по Санкт-Петербургу и Москве курьером. Гарантированное качество от производителя анонимность покупки.
Written on Tue, 13 May 2025 18:50:46 by mob.genmens.ru
Заходите https://uslugi-uborki-spb24.ru - Клининг генеральная уборка
Written on Tue, 13 May 2025 02:13:07 by Norbertvax
quasi quos alias quisquam sed velit voluptatem facere. repellat illo magnam tempora temporibus qui est iusto maxime quaerat natus quia facere sit quia nemo voluptatem reprehenderit.
Written on Sun, 23 Jun 2024 21:19:50 by sorgelakhanakp9z5 6u1ls6dilaef@gmail.com