Hi everyone, my university has some ST Discovery boards laying around and I wanted to have a little go with them. Tried using some code and it built ok with no errors but for some reason the LED is not lighting up. I am hoping to do a few things with this board and wondered if anyone knows the board well and might be able to help me? If anyone knows the hardware please post here and I have a few questions. I am using uVision v.4.74.
It builds fine but when I try to load it I get a debug cortex error saying "unknown target connected". How do I make sure I am properly targeting the hardware?
It builds fine but when I try to load it I get a debug cortex error saying "unknown target connected". How do I make sure I am properly targeting the hardware?
Code:
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#define LED GPIO_Pin_8
void init(void);
void delay(uint32_t ms);
int main()
{
init();
while(1)
{
GPIO_ToggleBits(GPIOA, LED);
delay(10000);
}
}
void init()
{
GPIO_InitTypeDef gpio_init_structure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
GPIO_StructInit(&gpio_init_structure);
gpio_init_structure.GPIO_Mode = GPIO_Mode_OUT;
gpio_init_structure.GPIO_Pin = LED;
gpio_init_structure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &gpio_init_structure);
}
void delay(uint32_t ms)
{
ms *= (168000000 / 4) / 1000;
while(ms--)
{
__NOP();
}
}
Attachments
-
1.7 MB Views: 41