WiP on hotplate temp reading
This commit is contained in:
8
Documentation/Hardware.md
Normal file
8
Documentation/Hardware.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
## Notes on the various supported hardware
|
||||||
|
|
||||||
|
### MHP30
|
||||||
|
|
||||||
|
- Accelerometer is the MSA301, this is mounted roughly in the middle of the unit
|
||||||
|
- USB-PD is using the FUSB302
|
||||||
|
- The hardware I2C bus on PB6/7 is used for the MSA301 and FUSB302
|
||||||
|
- The OLED is the same SSD1306 as everything else, but its on a bit-banged bus
|
||||||
@@ -57,7 +57,7 @@ void InterruptHandler::readPendingMessage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterruptHandler::Thread(const void *arg) {
|
void InterruptHandler::Thread(const void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
union fusb_status status;
|
union fusb_status status;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "MSA301_defines.h"
|
#include "MSA301_defines.h"
|
||||||
#include <MSA301.h>
|
#include <MSA301.h>
|
||||||
#define MSA301_I2C_ADDRESS 0x26<<1
|
#define MSA301_I2C_ADDRESS 0x26 << 1
|
||||||
bool MSA301::detect() { return FRToSI2C::probe(MSA301_I2C_ADDRESS); }
|
bool MSA301::detect() { return FRToSI2C::probe(MSA301_I2C_ADDRESS); }
|
||||||
|
|
||||||
static const FRToSI2C::I2C_REG i2c_registers[] = {
|
static const FRToSI2C::I2C_REG i2c_registers[] = {
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
*
|
*
|
||||||
* This was bought to my attention by <Kuba Sztandera>
|
* This was bought to my attention by <Kuba Sztandera>
|
||||||
*/
|
*/
|
||||||
|
volatile uint32_t lastuv = 0;
|
||||||
uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool skipCalOffset) {
|
uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool skipCalOffset) {
|
||||||
// This takes the raw ADC samples, converts these to uV
|
// This takes the raw ADC samples, converts these to uV
|
||||||
// Then divides this down by the gain to convert to the uV on the input to the op-amp (A+B terminals)
|
// Then divides this down by the gain to convert to the uV on the input to the op-amp (A+B terminals)
|
||||||
// Then remove the calibration value that is stored as a tip offset
|
// Then remove the calibration value that is stored as a tip offset
|
||||||
@@ -48,7 +48,7 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool skipCalOffse
|
|||||||
else
|
else
|
||||||
valueuV = 0;
|
valueuV = 0;
|
||||||
}
|
}
|
||||||
|
lastuv = valueuV;
|
||||||
return valueuV;
|
return valueuV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,56 +126,34 @@ const uint16_t uVtoDegC[] = {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
0, 0, //
|
0, 0, //
|
||||||
266, 10, //
|
397, 10, //
|
||||||
522, 20, //
|
798, 20, ///
|
||||||
770, 30, //
|
1203, 30, //
|
||||||
1010, 40, //
|
1612, 40, //
|
||||||
1244, 50, //
|
2023, 50, //
|
||||||
1473, 60, //
|
2436, 60, //
|
||||||
1697, 70, //
|
3225, 79, //
|
||||||
1917, 80, //
|
4013, 98, //
|
||||||
2135, 90, //
|
4756, 116, //
|
||||||
2351, 100, //
|
5491, 134, //
|
||||||
2566, 110, //
|
5694, 139, //
|
||||||
2780, 120, //
|
6339, 155, //
|
||||||
2994, 130, //
|
7021, 172, //
|
||||||
3209, 140, //
|
7859, 193, //
|
||||||
3426, 150, //
|
8619, 212, //
|
||||||
3644, 160, //
|
9383, 231, //
|
||||||
3865, 170, //
|
10153, 250, //
|
||||||
4088, 180, //
|
10930, 269, //
|
||||||
4314, 190, //
|
11712, 288, //
|
||||||
4544, 200, //
|
12499, 307, //
|
||||||
4777, 210, //
|
13290, 326, //
|
||||||
5014, 220, //
|
14084, 345, //
|
||||||
5255, 230, //
|
14881, 364, //
|
||||||
5500, 240, //
|
15680, 383, //
|
||||||
5750, 250, //
|
16482, 402, //
|
||||||
6003, 260, //
|
17285, 421, //
|
||||||
6261, 270, //
|
18091, 440, //
|
||||||
6523, 280, //
|
18898, 459, //
|
||||||
6789, 290, //
|
|
||||||
7059, 300, //
|
|
||||||
7332, 310, //
|
|
||||||
7609, 320, //
|
|
||||||
7889, 330, //
|
|
||||||
8171, 340, //
|
|
||||||
8456, 350, //
|
|
||||||
8742, 360, //
|
|
||||||
9030, 370, //
|
|
||||||
9319, 380, //
|
|
||||||
9607, 390, //
|
|
||||||
9896, 400, //
|
|
||||||
10183, 410, //
|
|
||||||
10468, 420, //
|
|
||||||
10750, 430, //
|
|
||||||
11029, 440, //
|
|
||||||
11304, 450, //
|
|
||||||
11573, 460, //
|
|
||||||
11835, 470, //
|
|
||||||
12091, 480, //
|
|
||||||
12337, 490, //
|
|
||||||
12575, 500, //
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -266,9 +244,10 @@ uint32_t TipThermoModel::convertFtoC(uint32_t degF) {
|
|||||||
}
|
}
|
||||||
return ((degF - 32) * 5) / 9;
|
return ((degF - 32) * 5) / 9;
|
||||||
}
|
}
|
||||||
|
volatile uint32_t lastTemp=0;
|
||||||
uint32_t TipThermoModel::getTipInC(bool sampleNow) {
|
uint32_t TipThermoModel::getTipInC(bool sampleNow) {
|
||||||
int32_t currentTipTempInC = TipThermoModel::convertTipRawADCToDegC(getTipRawTemp(sampleNow));
|
int32_t currentTipTempInC = TipThermoModel::convertTipRawADCToDegC(getTipRawTemp(sampleNow));
|
||||||
|
lastTemp=currentTipTempInC;
|
||||||
currentTipTempInC += getHandleTemperature() / 10; // Add handle offset
|
currentTipTempInC += getHandleTemperature() / 10; // Add handle offset
|
||||||
// Power usage indicates that our tip temp is lower than our thermocouple temp.
|
// Power usage indicates that our tip temp is lower than our thermocouple temp.
|
||||||
// I found a number that doesn't unbalance the existing PID, causing overshoot.
|
// I found a number that doesn't unbalance the existing PID, causing overshoot.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
#ifdef MODEL_MHP30
|
#ifdef MODEL_MHP30
|
||||||
#define VOLTAGE_DIV 350 // Default for MHP30
|
#define VOLTAGE_DIV 350 // Default for MHP30
|
||||||
#define PID_POWER_LIMIT 65 // Sets the max pwm power limit
|
#define PID_POWER_LIMIT 65 // Sets the max pwm power limit
|
||||||
#define CALIBRATION_OFFSET 900 // the adc offset in uV
|
#define CALIBRATION_OFFSET 0 // the adc offset in uV
|
||||||
#define POWER_LIMIT 65 // 65 watts default power limit
|
#define POWER_LIMIT 65 // 65 watts default power limit
|
||||||
#define MAX_POWER_LIMIT 65 //
|
#define MAX_POWER_LIMIT 65 //
|
||||||
#define POWER_LIMIT_STEPS 2 //
|
#define POWER_LIMIT_STEPS 2 //
|
||||||
@@ -197,5 +197,5 @@ const uint8_t tipResistance = 45; // x10 ohms, 4.5 typical for ts80 tips
|
|||||||
|
|
||||||
#ifdef MODEL_MHP30
|
#ifdef MODEL_MHP30
|
||||||
const uint32_t tipMass = 100; // TODO
|
const uint32_t tipMass = 100; // TODO
|
||||||
const uint8_t tipResistance = 75; // x10 ohms, ~6 typical
|
const uint8_t tipResistance = 75; // x10 ohms, ~6 typical
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ endif
|
|||||||
|
|
||||||
ALL_MINIWARE_MODELS=TS100 TS80 TS80P
|
ALL_MINIWARE_MODELS=TS100 TS80 TS80P
|
||||||
ALL_PINE_MODELS=Pinecil
|
ALL_PINE_MODELS=Pinecil
|
||||||
ALL_MODELS=$(ALL_MINIWARE_MODELS) $(ALL_PINE_MODELS)
|
ALL_MHP30_MODELS=MHP30
|
||||||
|
ALL_MODELS=$(ALL_MINIWARE_MODELS) $(ALL_PINE_MODELS) $(ALL_MHP30_MODELS)
|
||||||
ifneq ($(model),$(filter $(model),$(ALL_MODELS)))
|
ifneq ($(model),$(filter $(model),$(ALL_MODELS)))
|
||||||
$(error Invalid model '$(model)', valid options are: $(ALL_MODELS))
|
$(error Invalid model '$(model)', valid options are: $(ALL_MODELS))
|
||||||
endif
|
endif
|
||||||
@@ -27,9 +28,15 @@ MINIWARE_INC_CMSIS_DEVICE = ./Core/BSP/Miniware/Vendor/CMSIS/Device/ST/STM32F1xx
|
|||||||
MINIWARE_CMSIS_CORE_INC_DIR = ./Core/BSP/Miniware/Vendor/CMSIS/Include
|
MINIWARE_CMSIS_CORE_INC_DIR = ./Core/BSP/Miniware/Vendor/CMSIS/Include
|
||||||
MINIWARE_HAL_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
|
MINIWARE_HAL_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
|
||||||
MINIWARE_HAL_LEGACY_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
|
MINIWARE_HAL_LEGACY_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
|
||||||
|
MINIWARE_STARTUP_DIR = ./Startup
|
||||||
|
MHP30_INC_CMSIS_DEVICE = ./Core/BSP/MHP30/Vendor/CMSIS/Device/ST/STM32F1xx/Include
|
||||||
|
MHP30_CMSIS_CORE_INC_DIR = ./Core/BSP/MHP30/Vendor/CMSIS/Include
|
||||||
|
MHP30_HAL_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc
|
||||||
|
MHP30_HAL_LEGACY_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
|
||||||
|
MHP30_STARTUP_DIR = ./Startup
|
||||||
|
|
||||||
FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
|
FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
|
||||||
FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
|
FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
|
||||||
MINIWARE_STARTUP_DIR = ./Startup
|
|
||||||
DRIVER_INC_DIR =./Core/Drivers
|
DRIVER_INC_DIR =./Core/Drivers
|
||||||
BSP_INC_DIR = ./Core/BSP
|
BSP_INC_DIR = ./Core/BSP
|
||||||
THREADS_INC_DIR = ./Core/Threads
|
THREADS_INC_DIR = ./Core/Threads
|
||||||
@@ -80,7 +87,33 @@ CPUFLAGS= -mcpu=cortex-m3 \
|
|||||||
flash_size=64k
|
flash_size=64k
|
||||||
bootldr_size=0x4000
|
bootldr_size=0x4000
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(model),$(filter $(model),$(ALL_MHP30_MODELS)))
|
||||||
|
$(info Building for MHP30 )
|
||||||
|
DEVICE_INCLUDES = -I$(MHP30_INC_DIR) \
|
||||||
|
-I$(MHP30_INC_CMSIS_DEVICE)\
|
||||||
|
-I$(MHP30_CMSIS_CORE_INC_DIR) \
|
||||||
|
-I$(MHP30_HAL_INC_DIR) \
|
||||||
|
-I$(MHP30_HAL_LEGACY_INC_DIR)
|
||||||
|
DEVICE_BSP_DIR = ./Core/BSP/MHP30
|
||||||
|
S_SRCS := $(shell find $(MHP30_STARTUP_DIR) -type f -name '*.S')
|
||||||
|
LDSCRIPT=stm32f103.ld
|
||||||
|
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
||||||
|
-D ARM_MATH_CM3 \
|
||||||
|
-D STM32F10X_MD
|
||||||
|
DEV_LDFLAGS=-lm -Wl,--gc-sections
|
||||||
|
DEV_AFLAGS=
|
||||||
|
DEV_CFLAGS= -D GCC_ARMCM3 \
|
||||||
|
-D ARM_MATH_CM3 \
|
||||||
|
-D STM32F10X_MD
|
||||||
|
DEV_CXXFLAGS= -D GCC_ARMCM3 \
|
||||||
|
-D ARM_MATH_CM3 \
|
||||||
|
-D STM32F10X_MD
|
||||||
|
CPUFLAGS= -mcpu=cortex-m3 \
|
||||||
|
-mthumb \
|
||||||
|
-mfloat-abi=soft
|
||||||
|
flash_size=128k
|
||||||
|
bootldr_size=0x0000
|
||||||
|
endif
|
||||||
ifeq ($(model),$(ALL_PINE_MODELS))
|
ifeq ($(model),$(ALL_PINE_MODELS))
|
||||||
$(info Building for Pine64 )
|
$(info Building for Pine64 )
|
||||||
DEVICE_INCLUDES = -I$(PINE_INC_DIR) \
|
DEVICE_INCLUDES = -I$(PINE_INC_DIR) \
|
||||||
@@ -158,7 +191,7 @@ COMPILER=gcc
|
|||||||
# arm-none-eabi is the general ARM compiler,
|
# arm-none-eabi is the general ARM compiler,
|
||||||
# riscv-none-embed is the riscv compiler
|
# riscv-none-embed is the riscv compiler
|
||||||
# riscv-nuclei-elf is the nuclei tuned one for their cores
|
# riscv-nuclei-elf is the nuclei tuned one for their cores
|
||||||
ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS)))
|
ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS) $(ALL_MHP30_MODELS)))
|
||||||
COMPILER_PREFIX=arm-none-eabi
|
COMPILER_PREFIX=arm-none-eabi
|
||||||
endif
|
endif
|
||||||
ifeq ($(model),$(ALL_PINE_MODELS))
|
ifeq ($(model),$(ALL_PINE_MODELS))
|
||||||
|
|||||||
Reference in New Issue
Block a user