-
Notifications
You must be signed in to change notification settings - Fork 2
STM32F103C8T6 (6. Aplinkos (Visual Studio Code) paruošimas)
blahlt edited this page Mar 1, 2021
·
3 revisions
- Instaliuojam Visual Studio Code
- Į VSCode instaliuojam PlatformIO
- Per PlatformIO kuriam New Project
3a. Irašom Name
3b. Board pasirenkam BluePill F103C8 (Generic)
3c. Framework pasirenkam CMSIS - Sukuriam src\main.cpp
#include "stm32f1xx.h"
void delay(int d)
{
while (d-- > 0) {
volatile int x=500;
while (x-- > 0) {
__asm("nop");
}
}
}
int main(void)
{
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
GPIOC->CRH |= GPIO_CRH_MODE13_0;
for (;;) {
delay(100);
GPIOC->ODR ^= (1<<13);
}
return 0;
}Jei paspaudus Upload meta klaidos pranešima Error: init mode failed (unable to connect to the target) tai prieš spaudžiant Upload ant BluePill (STM32F103C8T6) reikia nuspausti RESET ir laikyti.
Jei nepadeda - ištraukti-įkišti ST-LINKv2 (kartais irgi nesuveikia iš pirmo karto).