From 2b717c91daccc19f8e0fc6ba23421dd22fba688e Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 21 Sep 2018 10:37:11 +0900 Subject: [PATCH] Add FST-01SZ support. --- ChangeLog | 6 ++++++ board/board-fst-01sz.h | 37 +++++++++++++++++++++++++++++++++++++ contrib/adc-stm32f103.c | 1 + mcu/sys-stm32f103.h | 1 + 4 files changed, 45 insertions(+) create mode 100644 board/board-fst-01sz.h diff --git a/ChangeLog b/ChangeLog index f08fb46..be6a86e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-09-21 NIIBE Yutaka + + * board/board-fst-01sz.h: New. + * mcu/sys-stm32f103.h (BOARD_ID_FST_01SZ): New. + * contrib/adc-stm32f103.c (get_adc_config): Add BOARD_ID_FST_01SZ. + 2018-08-20 NIIBE Yutaka * mcu/usb-stm32f103.c (usb_lld_ctrl_send): Fix for ZLP. diff --git a/board/board-fst-01sz.h b/board/board-fst-01sz.h new file mode 100644 index 0000000..c161753 --- /dev/null +++ b/board/board-fst-01sz.h @@ -0,0 +1,37 @@ +#define BOARD_NAME "FST-01SZ" +#define BOARD_ID 0x7e6fb084 +/* echo -n "FST-01SZ" | sha256sum | sed -e 's/^.*\(........\) -$/\1/' */ + +#define MCU_STM32F1_GD32F1 1 +#define STM32_USBPRE STM32_USBPRE_DIV2 +#define STM32_ADCPRE STM32_ADCPRE_DIV8 + +#define MCU_STM32F1 1 +#define STM32F10X_MD /* Medium-density device */ + +#define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 +#define STM32_PLLMUL_VALUE 8 +#define STM32_HSECLK 12000000 + +#define GPIO_LED_BASE GPIOA_BASE +#define GPIO_LED_SET_TO_EMIT 8 +#define GPIO_USB_BASE GPIOA_BASE +#undef GPIO_OTHER_BASE + +/* + * Port A setup. + * PA0 - input with pull-up: AN0 for NeuG + * PA1 - input with pull-up: AN1 for NeuG + * PA3 - input with pull-up: Hall sensor output + * PA8 - Push pull output 10MHz 0 default (LED 1:ON 0:OFF) + * PA11 - Push Pull output 10MHz 0 default (until USB enabled) (USBDM) + * PA12 - Push Pull output 10MHz 0 default (until USB enabled) (USBDP) + * ------------------------ Default + * PAx - input with pull-up. + */ +#define VAL_GPIO_LED_ODR 0xFFFFE6FF +#define VAL_GPIO_LED_CRL 0x88888888 /* PA7...PA0 */ +#define VAL_GPIO_LED_CRH 0x88811881 /* PA15...PA8 */ + +#define RCC_ENR_IOP_EN RCC_APB2ENR_IOPAEN +#define RCC_RSTR_IOP_RST RCC_APB2RSTR_IOPARST diff --git a/contrib/adc-stm32f103.c b/contrib/adc-stm32f103.c index 1f7867c..fe838d9 100644 --- a/contrib/adc-stm32f103.c +++ b/contrib/adc-stm32f103.c @@ -192,6 +192,7 @@ get_adc_config (uint32_t config[4]) case BOARD_ID_STM8S_DISCOVERY: case BOARD_ID_ST_DONGLE: case BOARD_ID_NITROKEY_START: + case BOARD_ID_FST_01SZ: default: config[0] = 0; config[1] = ADC_SMPR2_SMP_AN0(ADC_SAMPLE_1P5) diff --git a/mcu/sys-stm32f103.h b/mcu/sys-stm32f103.h index 87d3eb4..2492acc 100644 --- a/mcu/sys-stm32f103.h +++ b/mcu/sys-stm32f103.h @@ -2,6 +2,7 @@ #define BOARD_ID_FST_01_00 0x613870a9 #define BOARD_ID_FST_01 0x696886af #define BOARD_ID_FST_01G 0x8801277f +#define BOARD_ID_FST_01SZ 0x7e6fb084 #define BOARD_ID_MAPLE_MINI 0x7a445272 #define BOARD_ID_OLIMEX_STM32_H103 0xf92bb594 #define BOARD_ID_STBEE_MINI 0x1f341961