* Some Fixes to work * Fix BluePill * Remove libmaple defs * STM32 Timers rework * GCC9 Fix * BlackPill update * Disable FRAM as default for STM32 * STM32 storage options for all cores * STM32 fixes 2 * Update FRAM lib * Fix previos ADC 'fixed definitions' * Fix duplicated pins * Typo * Fix compilation error for BluePill * Fix timers Prescale
This commit is contained in:
parent
228d491098
commit
433de94f81
|
@ -39,26 +39,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
//Much of the below is not correct, but included to allow compilation
|
||||
//STM32F1/variants/.../board.cpp
|
||||
#if defined (STM32F4)
|
||||
#define A0 PA0
|
||||
#define A1 PA1
|
||||
#define A2 PA2
|
||||
#define A3 PA3
|
||||
#define A4 PA4
|
||||
#define A5 PA5
|
||||
#define A6 PA6
|
||||
#define A7 PA7
|
||||
#define A8 PB0
|
||||
#define A9 PB1
|
||||
#define A10 PC0
|
||||
#define A11 PC1
|
||||
#define A12 PC2
|
||||
#define A13 PC3
|
||||
#define A14 PC4
|
||||
#define A15 PC5
|
||||
#else
|
||||
#if !defined (A0)
|
||||
#define A0 PA0
|
||||
#define A1 PA1
|
||||
#define A2 PA2
|
||||
|
@ -69,7 +50,9 @@
|
|||
#define A7 PA7
|
||||
#define A8 PB0
|
||||
#define A9 PB1
|
||||
#endif
|
||||
//STM32F1 have only 10 12bit adc
|
||||
#if !defined (A10)
|
||||
#define A10 PA0
|
||||
#define A11 PA1
|
||||
#define A12 PA2
|
||||
|
|
|
@ -68,17 +68,17 @@ void initBoard()
|
|||
#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB)
|
||||
//(CYCLES_PER_MICROSECOND == 72, APB2 at 72MHz, APB1 at 36MHz).
|
||||
//Timer2 to 4 is on APB1, Timer1 on APB2. www.st.com/resource/en/datasheet/stm32f103cb.pdf sheet 12
|
||||
Timer1.setPrescaleFactor((72 * 2)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor((36 * 2)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor((36 * 2)-1); //2us resolution
|
||||
Timer1.setPrescaleFactor(((Timer1.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
#else
|
||||
//(CYCLES_PER_MICROSECOND == 168, APB2 at 84MHz, APB1 at 42MHz).
|
||||
//Timer2 to 14 is on APB1, Timers 1, 8, 9 and 10 on APB2. www.st.com/resource/en/datasheet/stm32f407vg.pdf sheet 120
|
||||
Timer1.setPrescaleFactor((168 * 2)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor((84 * 2)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor((84 * 2)-1); //2us resolution
|
||||
Timer4.setPrescaleFactor((84 * 2)-1); //2us resolution
|
||||
Timer5.setPrescaleFactor((84 * 2)-1); //2us resolution
|
||||
Timer1.setPrescaleFactor(((Timer1.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer4.setPrescaleFactor(((Timer4.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer5.setPrescaleFactor(((Timer5.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
#endif
|
||||
Timer2.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer2.setMode(2, TIMER_OUTPUT_COMPARE);
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
#ifndef STM32F407VE_H
|
||||
#define STM32F407VE_H
|
||||
#ifndef STM32OFFICIAL_H
|
||||
#define STM32OFFICIAL_H
|
||||
#if defined(CORE_STM32_OFFICIAL)
|
||||
#include <Arduino.h>
|
||||
#include <HardwareTimer.h>
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#if defined(STM32F1)
|
||||
#include "stm32f1xx_ll_tim.h"
|
||||
#elif defined(STM32F3)
|
||||
#include "stm32f3xx_ll_tim.h"
|
||||
#elif defined(STM32F4)
|
||||
#include "stm32f4xx_ll_tim.h"
|
||||
#else /*Default should be STM32F4*/
|
||||
#include "stm32f4xx_ll_tim.h"
|
||||
#endif
|
||||
/*
|
||||
***********************************************************************************************************
|
||||
* General
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
Timer2.setOverflow(0xFFFF, MICROSEC_FORMAT);
|
||||
Timer3.setOverflow(0xFFFF, MICROSEC_FORMAT);
|
||||
|
||||
Timer1.setPrescaleFactor(((Timer1.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
|
||||
Timer2.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer2.setMode(2, TIMER_OUTPUT_COMPARE);
|
||||
|
@ -92,6 +95,7 @@
|
|||
Timer3.attachInterrupt(4, fuelSchedule4Interrupt);
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
Timer5.setOverflow(0xFFFF, MICROSEC_FORMAT);
|
||||
Timer5.setPrescaleFactor(((Timer5.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer5.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer5.attachInterrupt(1, fuelSchedule5Interrupt);
|
||||
#endif
|
||||
|
@ -114,6 +118,7 @@
|
|||
Timer2.attachInterrupt(3, ignitionSchedule3Interrupt);
|
||||
Timer2.attachInterrupt(4, ignitionSchedule4Interrupt);
|
||||
#if (IGN_CHANNELS >= 5)
|
||||
Timer4.setPrescaleFactor(((Timer4.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer4.setOverflow(0xFFFF, MICROSEC_FORMAT);
|
||||
Timer4.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer4.attachInterrupt(1, ignitionSchedule5Interrupt);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#define INJ_CHANNELS 4
|
||||
#define IGN_CHANNELS 5
|
||||
|
||||
//Select one for EEPROM, default is emulated and is very slow
|
||||
//Select one for EEPROM, default are emulated and is very slow
|
||||
//#define SRAM_AS_EEPROM /*Use RTC registers, requires a 3V battery connected to Vbat pin */
|
||||
//#define SPIFLASH_AS_EEPROM /*Use M25Qxx SPI flash */
|
||||
//#define FRAM_AS_EEPROM /*Use FRAM like FM25xxx, MB85RSxxx or any SPI compatible */
|
||||
|
|
|
@ -1211,12 +1211,12 @@ void setPinMapping(byte boardID)
|
|||
pinO2 = A8; //O2 Sensor pin
|
||||
pinBat = A4; //Battery reference voltage pin
|
||||
pinBaro = pinMAP;
|
||||
pinIdle1 = PB2; //Single wire idle control
|
||||
pinBoost = PA8; //Boost control
|
||||
pinIdle1 = PA5; //Single wire idle control
|
||||
pinBoost = PA6; //Boost control
|
||||
//pinVVT_1 = 4; //Default VVT output
|
||||
pinStepperDir = PC15; //Direction pin for DRV8825 driver
|
||||
pinStepperStep = PC14; //Step pin for DRV8825 driver
|
||||
pinStepperEnable = PC13; //Enable pin for DRV8825
|
||||
//pinStepperEnable = PC13; //Enable pin for DRV8825
|
||||
pinFuelPump = PB10; //Fuel pump output
|
||||
pinTachOut = PC13; //Tacho output pin
|
||||
//external interrupt enabled pins
|
||||
|
|
Loading…
Reference in New Issue