From 0ee93edf61060ce9b593bae03062508c7a2acf35 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 19 Nov 2012 20:14:16 +0100 Subject: Added F3 support. --- SConstruct | 3 ++- laks | 2 +- main.cpp | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 574f656..de0f014 100644 --- a/SConstruct +++ b/SConstruct @@ -7,6 +7,7 @@ env = Environment( SConscript('laks/build_rules') #env.SelectMCU('stm32f103cb') -env.SelectMCU('stm32f407zg') +env.SelectMCU('stm32f303vc') +#env.SelectMCU('stm32f407zg') env.Firmware('demo.elf', Glob('*.cpp')) diff --git a/laks b/laks index fca8655..f836b28 160000 --- a/laks +++ b/laks @@ -1 +1 @@ -Subproject commit fca86554077f380c639409331c10a3dd4680d8a9 +Subproject commit f836b288b019f58c0d0a7e2dcbf56972e42ce4f4 diff --git a/main.cpp b/main.cpp index 1f4ea91..ca2f97a 100644 --- a/main.cpp +++ b/main.cpp @@ -35,6 +35,16 @@ Pin& led1 = PB1; USB_f1 usb(USB, dev_desc_p, conf_desc_p); +#elif defined(STM32F3) +// STM32F3DISCOVERY. + +Pin& usb_dm = PA11; +Pin& usb_dp = PA12; + +Pin& led1 = PA15; // FIXME + +USB_f1 usb(USB, dev_desc_p, conf_desc_p); + #elif defined(STM32F4) // Generic F4. @@ -113,6 +123,19 @@ int main() { usb_disc.set_mode(Pin::Output); usb_disc.off(); + RCC.enable(RCC.USB); + #elif defined(STM32F3) + // Initialize system timer. + STK.LOAD = 72000000 / 8 / 1000; // 1000 Hz. + STK.CTRL = 0x03; + + RCC.enable(RCC.GPIOA); + + usb_dm.set_mode(Pin::AF); + usb_dm.set_af(14); + usb_dp.set_mode(Pin::AF); + usb_dp.set_af(14); + RCC.enable(RCC.USB); #elif defined(STM32F4) // Initialize system timer. -- cgit v1.2.3