gadget0: stm32l1: target the "hw1" test board explicitly
There's still no commonly available l1 with usb from ST, so target our own developed test host board instead of one developer's private board.
This commit is contained in:
parent
5609749411
commit
0a07355520
@ -32,7 +32,7 @@ INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
|
||||
OPENCM3_DIR=../..
|
||||
|
||||
### This section can go to an arch shared rules eventually...
|
||||
LDSCRIPT = ../../lib/stm32/l1/stm32l15xxb.ld
|
||||
LDSCRIPT = ../../lib/stm32/l1/stm32l15xx8.ld
|
||||
OPENCM3_LIB = opencm3_stm32l1
|
||||
OPENCM3_DEFS = -DSTM32L1
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m3
|
||||
|
@ -17,10 +17,15 @@
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* "generic" could be any L1 board, but this file is pre-configured for the
|
||||
* libopencm3-tests "hw1" board, with an stm32l151c8-A part.
|
||||
*/
|
||||
|
||||
#include <libopencm3/cm3/nvic.h>
|
||||
#include <libopencm3/stm32/gpio.h>
|
||||
#include <libopencm3/stm32/flash.h>
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
#include <libopencm3/stm32/syscfg.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include "usb-gadget0.h"
|
||||
@ -35,15 +40,16 @@
|
||||
#endif
|
||||
|
||||
const struct rcc_clock_scale this_clock_config = {
|
||||
/* 32MHz PLL from 8MHz HSE */
|
||||
/* 32MHz PLL from 16MHz HSE, 96MHz for USB on PLL VCO out */
|
||||
.pll_source = RCC_CFGR_PLLSRC_HSE_CLK,
|
||||
.pll_mul = RCC_CFGR_PLLMUL_MUL12,
|
||||
.pll_mul = RCC_CFGR_PLLMUL_MUL6,
|
||||
.pll_div = RCC_CFGR_PLLDIV_DIV3,
|
||||
.hpre = RCC_CFGR_HPRE_SYSCLK_NODIV,
|
||||
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
|
||||
.ppre2 = RCC_CFGR_PPRE2_HCLK_NODIV,
|
||||
.voltage_scale = PWR_SCALE1,
|
||||
.flash_waitstates = 1,
|
||||
.ahb_frequency = 32000000,
|
||||
.apb1_frequency = 32000000,
|
||||
.apb2_frequency = 32000000,
|
||||
};
|
||||
@ -51,19 +57,24 @@ const struct rcc_clock_scale this_clock_config = {
|
||||
|
||||
int main(void)
|
||||
{
|
||||
rcc_clock_setup_pll(&this_clock_config);
|
||||
/* LED on custom board for boot progress */
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO1);
|
||||
gpio_set(GPIOB, GPIO1);
|
||||
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8|GPIO9);
|
||||
gpio_set(GPIOB, GPIO8);
|
||||
rcc_clock_setup_pll(&this_clock_config);
|
||||
|
||||
/* Enable built in USB pullup on L1 */
|
||||
rcc_periph_clock_enable(RCC_SYSCFG);
|
||||
SYSCFG_PMC |= SYSCFG_PMC_USB_PU;
|
||||
|
||||
usbd_device *usbd_dev = gadget0_init(&st_usbfs_v1_usb_driver,
|
||||
"stm32l1-generic");
|
||||
|
||||
ER_DPRINTF("bootup complete\n");
|
||||
gpio_clear(GPIOB, GPIO1);
|
||||
gpio_clear(GPIOB, GPIO8);
|
||||
while (1) {
|
||||
gpio_set(GPIOB, GPIO9);
|
||||
gadget0_run(usbd_dev);
|
||||
gpio_clear(GPIOB, GPIO9);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user