From 669001fc7d824a0e25eba41869b4b0b66c980ee0 Mon Sep 17 00:00:00 2001 From: travisutk Date: Sun, 6 May 2012 13:52:46 +0000 Subject: [PATCH] GoodFET is booting on STM32. USB comms are next. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1159 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/lib/stm32f407.c | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/firmware/lib/stm32f407.c b/firmware/lib/stm32f407.c index 10ec8f4..23425ef 100644 --- a/firmware/lib/stm32f407.c +++ b/firmware/lib/stm32f407.c @@ -5,6 +5,39 @@ #include "platform.h" +#include "stm32f4xx.h" +//#include "stm322xg_eval.h" +#include +#include +#include +//#include "stm32f4_discovery.h" + + +void ioinit(){ + GPIO_InitTypeDef GPIO_InitStructure; + + /* GPIOD Periph clock enable */ + RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); + + /* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_Init(GPIOD, &GPIO_InitStructure); +} + + +void ledon(){ + //GPIOG->BSRRL=GPIO_Pin_14; + GPIO_ResetBits(GPIOD, GPIO_Pin_14); +} +void ledoff(){ + //GPIOG->BSRRH=GPIO_Pin_14; + GPIO_SetBits(GPIOD, GPIO_Pin_14); +} + //! Count the length of a string. uint32_t strlen(const char *s){ @@ -13,7 +46,13 @@ uint32_t strlen(const char *s){ //! Initialize the STM32F4xx ports and USB. void stm32f4xx_init(){ - + ioinit(); + while(1){ + ledon(); + delay(0x1000); + ledoff(); + delay(0x1000); + } } //! Receive a byte. -- 2.20.1