STM32 개발 보드를 프로그래밍하는 방법 또한 일부 데이터 시트와 일부 문서

ARM 마이크로 컨트롤러 프로그래밍을 처음 시작했지만 AVR 및 PIC 마이크로 컨트롤러에 대한 경험이 있습니다.

며칠 전 eBay에서 STM32F103VET6 개발 보드를 구입했습니다. 나는 지금이 보드를 프로그래밍하려고하지만 어디서부터 시작해야할지 모르겠다. 또한 일부 데이터 시트와 일부 문서 (모두 중국어)가 들어있는 CD를 받았습니다.

누군가 어떻게 시작하는지 말해 줄 수 있습니까? 아니면 누군가 소스 샘플이 있습니까?

Keil uVision4를 이미 설치했습니다. J- 링크 디버거도 있습니다.



답변

당신이보고 싶다면 깜박임 예가 있습니다.

#include "stm32f10x_conf.h"

/* led connected to a gpio pin */
#define LED1_PIN    GPIO_Pin_0
#define LED1_PORT   GPIOB
#define LED2_PIN    GPIO_Pin_3
#define LED2_PORT   GPIOC
#define LED3_PIN    GPIO_Pin_0
#define LED3_PORT   GPIOA
#define LED4_PIN    GPIO_Pin_0
#define LED4_PORT   GPIOE


/* user functions */
void delay(unsigned long count);

int main()
{
    GPIO_InitTypeDef GPIO_InitStructure;



    /* enable clock on GPIOB peripheral */
    //RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOA, ENABLE);


    /* set pin output mode */
    GPIO_InitStructure.GPIO_Pin = LED1_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(LED1_PORT, &GPIO_InitStructure);
    //LED 2
    GPIO_InitStructure.GPIO_Pin = LED2_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(LED2_PORT, &GPIO_InitStructure);
    //LED 3
    GPIO_InitStructure.GPIO_Pin = LED3_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(LED3_PORT, &GPIO_InitStructure);
    //LED 4
    GPIO_InitStructure.GPIO_Pin = LED4_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(LED4_PORT, &GPIO_InitStructure);
    while(1)
    {
        GPIO_SetBits(LED1_PORT, LED1_PIN);  // set pin high
        delay(2000000);
        GPIO_ResetBits(LED1_PORT, LED1_PIN);    // set pin low
        delay(2000000);

        GPIO_SetBits(LED2_PORT, LED2_PIN);  // set pin high
        delay(2000000);
        GPIO_ResetBits(LED2_PORT, LED2_PIN);    // set pin low
        delay(2000000);

        GPIO_SetBits(LED3_PORT, LED3_PIN);  // set pin high
        delay(2000000);
        GPIO_ResetBits(LED3_PORT, LED3_PIN);    // set pin low
        delay(2000000);

        GPIO_SetBits(LED4_PORT, LED4_PIN);  // set pin high
        delay(2000000);
        GPIO_ResetBits(LED4_PORT, LED4_PIN);    // set pin low
        delay(2000000);
    }
    //return 0;
}



void delay(unsigned long count)
{
    while(count--);
}

답변

매우 저렴한 STM32 디스커버리 보드도보십시오. Github에서 texane / stlink 프로젝트의 사본을 얻으십시오. 시작하기위한 유용한 소프트웨어 도구와 함께 매우 유용한 자습서가 있습니다.

다양한 장소에서 보드를 얻을 수 있습니다.

http://www.digikey.com/us/en/ph/ST/STM32_value_line_discovery.html

http://www.mouser.com/stm32discovery

http://www.newark.com/jsp/search/productdetail.jsp?SKU=21T4023

Github의 stlink 프로젝트는 다음과 같습니다.

https://github.com/texane/stlink


답변

STM32F103 프로그래밍에 대한 정보는 다음과 같습니다.

http://www.st.com/internet/mcu/product/164486.jsp

많은 예가 있습니다.

ST 보드 중 하나를 사용하면 다음과 같은 것이 훨씬 쉽습니다.

http://www.st.com/internet/evalboard/product/250863.jsp

그것들은 매우 저렴하고 많은 문서와 예제를 사용할 수 있습니다.