You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.0 KiB
83 lines
2.0 KiB
11 months ago
|
#include "stm32f4/inc/stm32f4xx.h"
|
||
|
#include "stm32f4/inc/stm32f4xx_hal_gpio_ex.h"
|
||
1 year ago
|
#define MCU_IDCODE 0x463U
|
||
|
|
||
2 years ago
|
// from the linker script
|
||
|
#define APP_START_ADDRESS 0x8004000U
|
||
|
|
||
|
#define CORE_FREQ 96U // in MHz
|
||
|
#define APB1_FREQ (CORE_FREQ/2U)
|
||
|
#define APB1_TIMER_FREQ (APB1_FREQ*2U) // APB1 is multiplied by 2 for the timer peripherals
|
||
|
#define APB2_FREQ (CORE_FREQ/2U)
|
||
|
#define APB2_TIMER_FREQ (APB2_FREQ*2U) // APB2 is multiplied by 2 for the timer peripherals
|
||
|
|
||
|
#define BOOTLOADER_ADDRESS 0x1FFF0004U
|
||
|
|
||
|
// Around (1Mbps / 8 bits/byte / 12 bytes per message)
|
||
|
#define CAN_INTERRUPT_RATE 12000U
|
||
|
|
||
|
#define MAX_LED_FADE 8192U
|
||
|
|
||
|
#define NUM_INTERRUPTS 102U // There are 102 external interrupt sources (see stm32f413.h)
|
||
|
|
||
|
#define TICK_TIMER_IRQ TIM1_BRK_TIM9_IRQn
|
||
|
#define TICK_TIMER TIM9
|
||
|
|
||
|
#define MICROSECOND_TIMER TIM2
|
||
|
|
||
|
#define INTERRUPT_TIMER_IRQ TIM6_DAC_IRQn
|
||
|
#define INTERRUPT_TIMER TIM6
|
||
|
|
||
|
#define IND_WDG IWDG
|
||
|
|
||
|
#define PROVISION_CHUNK_ADDRESS 0x1FFF79E0U
|
||
|
#define DEVICE_SERIAL_NUMBER_ADDRESS 0x1FFF79C0U
|
||
|
|
||
|
#include "can_definitions.h"
|
||
|
#include "comms_definitions.h"
|
||
|
|
||
|
#ifndef BOOTSTUB
|
||
1 year ago
|
#include "main_declarations.h"
|
||
2 years ago
|
#else
|
||
|
#include "bootstub_declarations.h"
|
||
|
#endif
|
||
|
|
||
|
#include "libc.h"
|
||
|
#include "critical.h"
|
||
|
#include "faults.h"
|
||
|
#include "utils.h"
|
||
|
|
||
|
#include "drivers/registers.h"
|
||
|
#include "drivers/interrupts.h"
|
||
|
#include "drivers/gpio.h"
|
||
11 months ago
|
#include "stm32f4/peripherals.h"
|
||
|
#include "stm32f4/interrupt_handlers.h"
|
||
2 years ago
|
#include "drivers/timers.h"
|
||
11 months ago
|
#include "stm32f4/board.h"
|
||
|
#include "stm32f4/clock.h"
|
||
2 years ago
|
#include "drivers/watchdog.h"
|
||
|
|
||
1 year ago
|
#include "drivers/spi.h"
|
||
11 months ago
|
#include "stm32f4/llspi.h"
|
||
2 years ago
|
|
||
1 year ago
|
#if !defined(BOOTSTUB)
|
||
2 years ago
|
#include "drivers/uart.h"
|
||
11 months ago
|
#include "stm32f4/lluart.h"
|
||
2 years ago
|
#endif
|
||
|
|
||
1 year ago
|
#ifdef BOOTSTUB
|
||
11 months ago
|
#include "stm32f4/llflash.h"
|
||
1 year ago
|
#else
|
||
11 months ago
|
#include "stm32f4/llbxcan.h"
|
||
2 years ago
|
#endif
|
||
|
|
||
11 months ago
|
#include "stm32f4/llusb.h"
|
||
2 years ago
|
|
||
|
void early_gpio_float(void) {
|
||
|
RCC->AHB1ENR = RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN | RCC_AHB1ENR_GPIOCEN;
|
||
|
|
||
|
GPIOA->MODER = 0; GPIOB->MODER = 0; GPIOC->MODER = 0;
|
||
|
GPIOA->ODR = 0; GPIOB->ODR = 0; GPIOC->ODR = 0;
|
||
|
GPIOA->PUPDR = 0; GPIOB->PUPDR = 0; GPIOC->PUPDR = 0;
|
||
|
}
|