17
\$\begingroup\$

I'm a total beginner with programming ARM microcontrollers, but I do have experience with AVR and PIC microcontrollers.

A few days back I have purchased a STM32F103VET6 development board from eBay. I'm now trying to program this board but I don't know where to start. I have also received a CD which contains some datasheets and some documents (all in Chinese).

Could someone tell me how to start? Or does someone have some source samples?

I have already installed Keil uVision4. I also have a J-link debugger.

\$\endgroup\$
  • 2
    \$\begingroup\$ Not sure why this was voted down. Looks like a clear question, properly articulated, and OP has tried to help himself. Relates to development/design, so seems on-topic. Voted up. \$\endgroup\$ – icarus74 Feb 3 '12 at 4:05
  • \$\begingroup\$ This is one of the downsides of buying dev boards on ebay, esply ones shipping from far-east. Often time, they are designed for local market, and getting a high quality english (a foreign language for them) manual created, seeding/developing/maintaining a user forum is too much cost and hassle. Also that is a market already served by slightly more expensive boards. Having said that, in the past I learnt this the hard way, and landed up translating most parts of manual in Chinese to English using google translator. Far from perfect, but got me moving. \$\endgroup\$ – icarus74 Feb 3 '12 at 4:07
  • \$\begingroup\$ Obviously, you need a softcopy of the manual, which has text as discrete characters, not a photo-image. OCR'd text is a strict no-no for this approach. \$\endgroup\$ – icarus74 Feb 3 '12 at 4:09
  • \$\begingroup\$ Oh, and one more thing. Most of these far-east dev boards are ~100% knock-offs of some dev boards by reputed companies like Olimex, IAR etc. So a detailed visual inspection of your board and these other can be quite revealing. Of course, there could be gotchas. And that is the price one pays for saving money, at times :-) \$\endgroup\$ – icarus74 Feb 3 '12 at 4:16
5
\$\begingroup\$

I have blinker example if you want to see

#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--);
}
\$\endgroup\$
3
\$\begingroup\$

Also look at the very affordable STM32 Discovery board. Grab a copy of the texane/stlink project on Github, which has a very helpful tutorial along with good software tools for getting started.

You can get the board at various places.

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

Here's the stlink project on Github.

https://github.com/texane/stlink

\$\endgroup\$
2
\$\begingroup\$

You'll find lots of info on programming the STM32F103 here:

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

with plenty of examples.

You'll find things much easier with one of the ST boards, such as this one:

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

They are very inexpensive and plenty of documentation and examples are available.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.