Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SEQURE S99, and new Rev. of S60P #1920

Open
wants to merge 39 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
653a080
Add support for Sequre S99, copied S60P settings
jonasius May 26, 2024
1521b5e
Add S99
jonasius May 26, 2024
a3b7abb
Add Sequre S99 with correct bootloader offset
jonasius May 26, 2024
5ea42a8
Add whitespaces according to coding style
jonasius May 26, 2024
2c5d2a0
Add whitespaces according to coding style
jonasius May 26, 2024
a306de5
Merge branch 'Ralim:dev' into dev
jonasius Jun 1, 2024
e327be5
Correct debug menu "Tip R" to "Tip uV"
jonasius Jun 2, 2024
a2615a5
Use SettingsOptions::PDNegTimeout in FS2711 driver
jonasius Jun 2, 2024
31ff398
Correct debug menu "Tip R" to "Tip uV"
jonasius Jun 3, 2024
6e53d85
Rename Sequre_S60 folder to Sequre
jonasius Jun 6, 2024
6ef1fbd
Support for S99
jonasius Jun 6, 2024
da28492
Add define for USB_PD_TIMEOUT, the default value for PDNegTimeout
jonasius Jun 6, 2024
f5d6d8b
Add define for USB_PD_TIMEOUT, the default value for PDNegTimeout
jonasius Jun 6, 2024
8514edf
Fix clang-format code style mismatches
jonasius Jun 6, 2024
b772e1d
Add S99 to overview table
jonasius Jun 19, 2024
c8c36d2
Fix clang-format code style mismatches
jonasius Jun 19, 2024
a626d5a
Fix missing PD related description of menu items and messages for POW…
jonasius Jun 25, 2024
c776390
Add pins for S99 v1.5 and probably S60P v1.2
jonasius Jun 25, 2024
e911726
Add experimental detection of separate USB-PD I2C bus for S99 v1.5 an…
jonasius Jun 25, 2024
51e08f3
Fix clang-format issues
jonasius Jun 25, 2024
0d74f77
Code cleanup, always init both I2C bus
jonasius Jun 25, 2024
56b91ac
Add missing __HAL_RCC_GPIOB_CLK_ENABLE
jonasius Jun 25, 2024
e6a3f38
4x faster PWM, add Timer changes from #1926
jonasius Jun 25, 2024
69493ba
Add missing braces
jonasius Jun 27, 2024
6ad0b65
Correct README to Sequre S60, S60P and S99
jonasius Jun 27, 2024
4634fa8
Fix showing displayPowerMenu for POW_PD and POW_PD_EXT 2
jonasius Jun 28, 2024
f21630e
Enable/add DC support for S60P
jonasius Jun 28, 2024
693c1a3
Merge branch 'dev' into dev
jonasius Jun 28, 2024
fa3d4d4
Merge branch 'dev' into dev
discip Jul 11, 2024
ae21be2
Merge branch 'dev' into dev
discip Jul 11, 2024
e79687e
Set equal USB_PD_TIMEOUT for all Sequre irons
jonasius Aug 5, 2024
a2734ee
Fix i2c_probe function
jonasius Aug 5, 2024
fcb1b37
Merge branch 'dev' of https://github.com/jonasius/IronOS into dev
jonasius Aug 5, 2024
a132d37
Merge remote-tracking branch 'upstream/dev' into dev
jonasius Aug 7, 2024
e667189
Add MODEL_S99
jonasius Aug 7, 2024
4b340c5
Add THERMAL_RUNAWAY config values for S99
jonasius Aug 7, 2024
2679a79
Merge branch 'dev' into dev
discip Aug 24, 2024
b036da9
Merge branch 'dev' into dev
discip Sep 4, 2024
35fd2f5
Merge branch 'dev' into dev
discip Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
"S60",
"S60P",
"T55",
"S99",
"TS101",
]
fail-fast: true
Expand Down
2 changes: 1 addition & 1 deletion Documentation/DebugMenu.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This can be used for checking performance of the movement detection code.

This indicates the tip resistance that the device is currently using. For devices with multiple possible values to choose from (Pinecil V2), the appropriate value is automatically detected at every boot-up. Tip should be installed before boot-up or reading can not be done.

### Tip R
### Tip uV

This is the raw tip reading in μV. Tip must be installed or reading will be high/inaccurate. At cool, the range of 700-1000 is normal for larger tips and ~1500 for smaller tips (TS80). This is used to evaluate the calibration routines.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DOCKER_CMD=$(DOCKER_BIN) -f $(DOCKER_YML) run --rm builder
MKDOCS_YML=$(CURDIR)/scripts/IronOS-mkdocs.yml

# supported models
MODELS=TS100 TS80 TS80P Pinecil MHP30 Pinecilv2 S60 TS101 S60P T55 # target names & dir names
MODELS=TS100 TS80 TS80P Pinecil MHP30 Pinecilv2 S60 TS101 S60P T55 S99 # target names & dir names
MODELS_ML=Pinecil Pinecilv2 # target names
MODELS_MULTILANG=Pinecil_multi-lang Pinecilv2_multi-lang # dir names

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ _This firmware does **NOT** support the USB port while running for changing sett
| Pinecil V2 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
| Miniware TS101 | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ✔️ | ✔️ | Full OLED resolution not yet supported. |
| Sequre S60 | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | Full OLED resolution not yet supported. |
| Sequre S60P | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | Full OLED resolution not yet supported. |
| Sequre S60P | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | Full OLED resolution not yet supported. |
| Sequre S99 | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | Full OLED resolution not yet supported. |
| Sequre T55 | ❌ | ❌ | ✔️ | ❌ | ❌ | N/A | ✔️ | Full OLED resolution not yet supported. |
| Miniware TS80P | ❌ | ✔️ | ✔️ | ❌ | ❌ | N/A | ✔️ | |
| Miniware TS100 | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌\*\* | |
Expand Down
2 changes: 1 addition & 1 deletion Translations/make_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_debug_menu() -> List[str]:
"UpTime ",
"Move ",
"Tip Res",
"Tip R ",
"Tip uV ",
"Tip O ",
"HW G ",
"HW M ",
Expand Down
6 changes: 3 additions & 3 deletions Translations/translations_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
"id": "NoPowerDeliveryMessage",
"include": ["POW_PD"],
"include": ["POW_PD", "POW_PD_EXT"],
"description": "The IC required for USB-PD could not be communicated with. This is an error warning that USB-PD WILL NOT FUNCTION. Generally indicative of either a hardware or software issues."
},
{
Expand Down Expand Up @@ -264,14 +264,14 @@
"id": "PDNegTimeout",
"maxLen": 8,
"maxLen2": 15,
"include": ["POW_PD"],
"include": ["POW_PD", "POW_PD_EXT"],
"description": "How long until firmware stops trying to negotiate for USB-PD and tries QC instead. Longer times may help dodgy / old PD adapters, faster times move onto PD quickly. Units of 100ms. Recommended to keep small values."
},
{
"id": "USBPDMode",
"maxLen": 7,
"maxLen2": 15,
"include": ["POW_PD"],
"include": ["POW_PD", "POW_PD_EXT"],
"description": "No Dynamic disables EPR & PPS, Safe mode does not use padding resistance"
},
{
Expand Down
1 change: 1 addition & 0 deletions source/Core/BSP/MHP30/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
#define PROFILE_SUPPORT
#define OLED_96x16 1
#define POW_PD 1
#define USB_PD_TIMEOUT 20 // Default Timeout for USB-PD Protocol negotiation in x100ms
#define POW_PD_EXT 0
#define USB_PD_EPR_WATTAGE 0 /*No EPR*/
#define TEMP_NTC
Expand Down
1 change: 1 addition & 0 deletions source/Core/BSP/Miniware/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
#define ADC_VDD_MV 3300 // ADC max reading millivolts

#define POW_PD_EXT 0
#define USB_PD_TIMEOUT 20 // Default Timeout for USB-PD Protocol negotiation in x100ms

// Deriving the Voltage div:
// Vin_max = (3.3*(r1+r2))/(r2)
Expand Down
1 change: 1 addition & 0 deletions source/Core/BSP/Pinecil/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
#define POW_PD 1
#define USB_PD_EPR_WATTAGE 0 /*No EPR (Yet?) */
#define POW_PD_EXT 0
#define USB_PD_TIMEOUT 20 // Default Timeout for USB-PD Protocol negotiation in x100ms
#define POW_QC 1
#define POW_DC 1
#define POW_QC_20V 1
Expand Down
1 change: 1 addition & 0 deletions source/Core/BSP/Pinecilv2/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
#define POW_PD 1 // Supported features
#define USB_PD_EPR_WATTAGE 140 // USB PD EPR Wattage
#define POW_PD_EXT 0 // Future-proof macro for other models with other PD modes
#define USB_PD_TIMEOUT 20 // Default Timeout for USB-PD Protocol negotiation in x100ms
#define POW_QC 1 // Supported features
#define POW_DC 1 // Supported features
#define POW_QC_20V 1 // Supported features
Expand Down
72 changes: 1 addition & 71 deletions source/Core/BSP/Sequre/BSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,77 +126,7 @@ void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
}
}

void unstick_I2C() {
#ifdef SCL_Pin
GPIO_InitTypeDef GPIO_InitStruct;
int timeout = 100;
int timeout_cnt = 0;

// 1. Clear PE bit.
hi2c1.Instance->CR1 &= ~(0x0001);
/**I2C1 GPIO Configuration
PB6 ------> I2C1_SCL
PB7 ------> I2C1_SDA
*/
// 2. Configure the SCL and SDA I/Os as General Purpose Output Open-Drain, High level (Write 1 to GPIOx_ODR).
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

GPIO_InitStruct.Pin = SCL_Pin;
HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET);

GPIO_InitStruct.Pin = SDA_Pin;
HAL_GPIO_Init(SDA_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_WritePin(SDA_GPIO_Port, SDA_Pin, GPIO_PIN_SET);

while (GPIO_PIN_SET != HAL_GPIO_ReadPin(SDA_GPIO_Port, SDA_Pin)) {
// Move clock to release I2C
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_RESET);
asm("nop");
asm("nop");
asm("nop");
asm("nop");
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET);

timeout_cnt++;
if (timeout_cnt > timeout) {
return;
}
}

// 12. Configure the SCL and SDA I/Os as Alternate function Open-Drain.
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

GPIO_InitStruct.Pin = SCL_Pin;
HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct);

GPIO_InitStruct.Pin = SDA_Pin;
HAL_GPIO_Init(SDA_GPIO_Port, &GPIO_InitStruct);

HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(SDA_GPIO_Port, SDA_Pin, GPIO_PIN_SET);

// 13. Set SWRST bit in I2Cx_CR1 register.
hi2c1.Instance->CR1 |= 0x8000;

asm("nop");

// 14. Clear SWRST bit in I2Cx_CR1 register.
hi2c1.Instance->CR1 &= ~0x8000;

asm("nop");

// 15. Enable the I2C peripheral by setting the PE bit in I2Cx_CR1 register
hi2c1.Instance->CR1 |= 0x0001;

// Call initialization function.
HAL_I2C_Init(&hi2c1);
#endif
}
void unstick_I2C() {}

uint8_t getButtonA() { return HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? 1 : 0; }
uint8_t getButtonB() { return HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ? 1 : 0; }
Expand Down
45 changes: 42 additions & 3 deletions source/Core/BSP/Sequre/Pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Author: Ralim
*/

#ifndef BSP_MINIWARE_PINS_H_
#define BSP_MINIWARE_PINS_H_
#ifndef BSP_SEQURE_PINS_H_
#define BSP_SEQURE_PINS_H_
#include "configuration.h"

#ifdef MODEL_S60
Expand Down Expand Up @@ -65,6 +65,45 @@
#define SCL2_GPIO_Port GPIOB
#define SDA2_Pin GPIO_PIN_7
#define SDA2_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_11
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_10
#define SDA_GPIO_Port GPIOB
// Pin gets pulled high on movement
#define MOVEMENT_Pin GPIO_PIN_3
#define MOVEMENT_GPIO_Port GPIOA

#endif

#ifdef MODEL_S99

#define KEY_B_Pin GPIO_PIN_1
#define KEY_B_GPIO_Port GPIOB
#define TMP36_INPUT_Pin GPIO_PIN_5
#define TMP36_INPUT_GPIO_Port GPIOA
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_5
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_5
#define TIP_TEMP_Pin GPIO_PIN_0
#define TIP_TEMP_GPIO_Port GPIOA
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_0
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_0
#define VIN_Pin GPIO_PIN_4
#define VIN_GPIO_Port GPIOA
#define VIN_ADC1_CHANNEL ADC_CHANNEL_4
#define VIN_ADC2_CHANNEL ADC_CHANNEL_4
#define KEY_A_Pin GPIO_PIN_0
#define KEY_A_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_8
#define PWM_Out_GPIO_Port GPIOB
#define PWM_Out_CHANNEL TIM_CHANNEL_3 // Timer 4; channel 3
#define SCL2_Pin GPIO_PIN_6
#define SCL2_GPIO_Port GPIOB
#define SDA2_Pin GPIO_PIN_7
#define SDA2_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_11
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_10
#define SDA_GPIO_Port GPIOB
// Pin gets pulled high on movement
#define MOVEMENT_Pin GPIO_PIN_3
#define MOVEMENT_GPIO_Port GPIOA
Expand Down Expand Up @@ -98,4 +137,4 @@

#endif // MODEL_T55

#endif /* BSP_MINIWARE_PINS_H_ */
#endif /* BSP_SEQURE_PINS_H_ */
20 changes: 19 additions & 1 deletion source/Core/BSP/Sequre/Power.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "BSP.h"
#include "BSP_Power.h"
#include "FS2711.hpp"
#include "Pins.h"
#include "QC3.h"
#include "Settings.h"
Expand All @@ -16,9 +17,26 @@ void power_check() {
return; // We are using PD
}
#endif
#if POW_PD_EXT == 2
if (FS2711::has_run_selection()) {
return;
}
#endif
#ifdef POW_QC
QC_resync();
#endif
}

bool getIsPoweredByDCIN() { return false; }
bool getIsPoweredByDCIN() {
#if POW_PD_EXT == 2 && defined(POW_DC)
if (!FS2711::has_run_selection()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

return true;
} else if (FS2711::debug_get_state().source_voltage > 0) {
return false;
} else {
return true;
}
#else
return false;
#endif
}
4 changes: 2 additions & 2 deletions source/Core/BSP/Sequre/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BSP section for STM32F103 based Miniware products
# BSP section for STM32F103 based Sequre products

This folder contains the hardware abstractions required for the TS100, TS80 and probably TS80P soldering irons.
This folder contains the hardware abstractions required for the S60, S60P and S99 soldering irons.

## Main abstractions

Expand Down
22 changes: 17 additions & 5 deletions source/Core/BSP/Sequre/Software_I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,32 @@
* Author: Ralim
*/

#ifndef BSP_MINIWARE_SOFTWARE_I2C_H_
#define BSP_MINIWARE_SOFTWARE_I2C_H_
#ifndef BSP_SEQURE_SOFTWARE_I2C_H_
#define BSP_SEQURE_SOFTWARE_I2C_H_
#include "BSP.h"
#include "configuration.h"
#include "stm32f1xx_hal.h"
#ifdef I2C_SOFT_BUS_2

#ifdef I2C_SOFT_BUS_1
#define SOFT_SCL1_HIGH() HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET)
#define SOFT_SCL1_LOW() HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_RESET)
#define SOFT_SDA1_HIGH() HAL_GPIO_WritePin(SDA_GPIO_Port, SDA_Pin, GPIO_PIN_SET)
#define SOFT_SDA1_LOW() HAL_GPIO_WritePin(SDA_GPIO_Port, SDA_Pin, GPIO_PIN_RESET)
#define SOFT_SDA1_READ() (HAL_GPIO_ReadPin(SDA_GPIO_Port, SDA_Pin) == GPIO_PIN_SET ? 1 : 0)
#define SOFT_SCL1_READ() (HAL_GPIO_ReadPin(SCL_GPIO_Port, SCL_Pin) == GPIO_PIN_SET ? 1 : 0)

#endif /* I2C_SOFT_BUS_1 */

#ifdef I2C_SOFT_BUS_2
#define SOFT_SCL2_HIGH() HAL_GPIO_WritePin(SCL2_GPIO_Port, SCL2_Pin, GPIO_PIN_SET)
#define SOFT_SCL2_LOW() HAL_GPIO_WritePin(SCL2_GPIO_Port, SCL2_Pin, GPIO_PIN_RESET)
#define SOFT_SDA2_HIGH() HAL_GPIO_WritePin(SDA2_GPIO_Port, SDA2_Pin, GPIO_PIN_SET)
#define SOFT_SDA2_LOW() HAL_GPIO_WritePin(SDA2_GPIO_Port, SDA2_Pin, GPIO_PIN_RESET)
#define SOFT_SDA2_READ() (HAL_GPIO_ReadPin(SDA2_GPIO_Port, SDA2_Pin) == GPIO_PIN_SET ? 1 : 0)
#define SOFT_SCL2_READ() (HAL_GPIO_ReadPin(SCL2_GPIO_Port, SCL2_Pin) == GPIO_PIN_SET ? 1 : 0)

#endif /* I2C_SOFT_BUS_2 */

// clang-format off
#define SOFT_I2C_DELAY() \
{ \
Expand All @@ -27,7 +40,6 @@
}
// clang-format on

#endif
// 40 ~= 100kHz; 15 gives around 250kHz or so which is fast _and_ stable

#endif /* BSP_MINIWARE_SOFTWARE_I2C_H_ */
#endif /* BSP_SEQURE_SOFTWARE_I2C_H_ */
7 changes: 7 additions & 0 deletions source/Core/BSP/Sequre/ThermoModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ TemperatureType_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
#ifdef TEMP_uV_LOOKUP_S60
TemperatureType_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return (tipuVDelta * 50) / 485; }
#endif // TEMP_uV_LOOKUP_S60

#ifdef TEMP_uV_LOOKUP_S99
// 42.85 uV / K -> 1/42.85 K/uV = 20/857
// TemperatureType_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return (tipuVDelta * 20) / 857; }
// Measurement is probably with heating element in series, thats why the reading differs from the approx 42.85 uV/K
TemperatureType_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return (tipuVDelta * 1) / 30; }
#endif // TEMP_uV_LOOKUP_S99
Loading