1


I'm using the STM32 F205VCT6. I have a simple blinking LED program written in C++ with VisualGDB (and VS 2013 Community). It works fine for pins like A1 and E2, but it doesn't for B6 and B7, where I want to plug in USART. Does the processor block it somehow? I have really no idea. Please help, thanks.

UPDATE: Link to the full project on Dropbox: https://www.dropbox.com/s/jk9r9avg276k6l3/LF-3.rar?dl=1

My program's code:

#include <stm32f2xx_gpio.h>
#include <stm32f2xx_rcc.h>

void Delay()
{
    int i;
    for (i = 0; i < 1000000; i++)
        asm("nop");
}

int main()
{
  GPIO_InitTypeDef GPIO_InitStructure;

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOB, &GPIO_InitStructure);

  for (;;)
  {
      GPIO_WriteBit(GPIOB, GPIO_Pin_6, Bit_SET);
      Delay();
      GPIO_WriteBit(GPIOB, GPIO_Pin_6, Bit_RESET);
      Delay();
  }
}
user2462898
  • 21
  • 1
  • 3
  • Is the program compiled without errors? – Eugene Sh. Mar 18 '15 at 19:03
  • Is this the entire test code? You haven't configured the alternate functions elsewhere to use USART1 have you? – Tut Mar 18 '15 at 19:23
  • That's full code. Compiles fine, no additional configuration. – user2462898 Mar 18 '15 at 19:24
  • Are you using any configuration tool from ST? Try using their STM32Cube software for your project and hardware configuration, it will save you the effort. – Eugene Sh. Mar 18 '15 at 19:46
  • It looks ok to me. What does the startup code look like? Are you sure there isn't something in there setting up USART1 for diagnostics or something? You might try adding GPIO_DeInit(GPIOB); prior to your GPIO_Init() call. Also, is your hardware known to be good? – Tut Mar 18 '15 at 19:47
  • Do you have access to "system_stm32f2xx.c"? It looks like only the object code is in your project. Sometimes there are board-specific configurations in there. – Tut Mar 18 '15 at 20:24

0 Answers0