diff options
author | Ben V. Brown <[email protected]> | 2023-08-02 15:52:49 +1000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-08-02 15:52:49 +1000 |
commit | c120af398addb847e10932c54112a3b0d43c1788 (patch) | |
tree | 17aa2be456fa3aa630aa1dfac4f1888fb28d75eb | |
parent | c4fd383694dbf277918a2c8ad00edc6eeb558ca1 (diff) | |
parent | 2d7abc274ae6d25bc72dab505a1f94abddc2b4f9 (diff) | |
download | IronOS-c120af398addb847e10932c54112a3b0d43c1788.tar.gz IronOS-c120af398addb847e10932c54112a3b0d43c1788.zip |
Merge branch 'dev' into Short-Detection
-rw-r--r-- | Documentation/Bluetooth.md | 99 | ||||
-rw-r--r-- | Documentation/Troubleshooting.md | 12 | ||||
-rw-r--r--[-rwxr-xr-x] | Translations/translation_JA_JP.json | 0 | ||||
-rw-r--r-- | source/Core/BSP/BSP.h | 3 | ||||
-rw-r--r-- | source/Core/BSP/MHP30/BSP.cpp | 5 | ||||
-rw-r--r-- | source/Core/BSP/MHP30/configuration.h | 4 | ||||
-rw-r--r-- | source/Core/BSP/Miniware/BSP.cpp | 5 | ||||
-rw-r--r-- | source/Core/BSP/Pinecil/BSP.cpp | 5 | ||||
-rw-r--r-- | source/Core/BSP/Pinecilv2/BSP.cpp | 11 | ||||
-rw-r--r-- | source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld | 2 | ||||
-rw-r--r-- | source/Core/BSP/Pinecilv2/configuration.h | 16 | ||||
-rw-r--r-- | source/Core/BSP/Sequre_S60/BSP.cpp | 5 | ||||
-rw-r--r-- | source/Core/Threads/GUIThread.cpp | 3 | ||||
-rw-r--r-- | source/Makefile | 3 |
14 files changed, 155 insertions, 18 deletions
diff --git a/Documentation/Bluetooth.md b/Documentation/Bluetooth.md new file mode 100644 index 00000000..4f60aa75 --- /dev/null +++ b/Documentation/Bluetooth.md @@ -0,0 +1,99 @@ +# Bluetooth Low Energy + +The Pinecilv2 has hardware support for Bluetooth Low Energy (BLE). This protocol allows reading and writing of parameters to the Pinecil during runtime. + +The BLE interface advertises three services, these provide access to live telemetry as well as the ability to read/write settings. +These are outlined in more detail below. + +Pinecil devices advertise themselves on BLE as `Pinecil-XXXXXXX`. +They also include the UUID `9eae1000-9d0d-48c5-AA55-33e27f9bc533` in the advertisement packet to allow for filtering. + +Unless otherwise noted, all data is sent and received as Little-Endian. + +As of the time of writing this, notifications are not fully implemented so data will need to be polled. Notification/Indication support will come when there is time to implement it. + +## Using the BLE Interface + +It is advised to follow the below points when first implementing a BLE integration. Of course once the integration is working feel free to deviate from these. These are just _suggested_ ideas to help kickstart. + +1. When filtering for devices, its preferable to filter by the UUID `9eae1000-9d0d-48c5-AA55-33e27f9bc533`, rather than by the device name if possible. +2. Upon first collection check if the three expected services exist; if they don't the user may have selected an incorrect device. +3. It's best to read the live bulk endpoint over the live service when its easy to do so (one read vs ~15). + 1. However if you are just updating one or two line items it may be more efficient to just read these on the live service. + 2. Feel free to test both and decide. +4. When reading settings from the device; the association of number <-> setting is fixed, but you may see settings you don't yet know about, make sure you can handle these. +5. You probably don't want to show unknown setting's to the user though. +6. Read the device firmware revision and ensure you can decode it. If BLE is revised it may be essential for handling versions cleanly. +7. It's advisable to keep an eye on the IronOS repository or at least setup the Github watch for release notifications. + 1. Future releases may revise some BLE aspects or add new settings for example. + +## Services + +Below is a description of each service. Note that the exact settings are not listed for brevity; it's best to refer to [the uuid lists](https://github.com/Ralim/IronOS/blob/dev/source/Core/BSP/Pinecilv2/ble_characteristics.h) and the [handlers](https://github.com/Ralim/IronOS/blob/dev/source/Core/BSP/Pinecilv2/ble_handlers.cpp) alongside this. + +### Live + +`UUID: d85ef000-168e-4a71-AA55-33e27f9bc533` + +The live services has one characteristic per reading. The readings (in order) are: +When implementing these; the ones that are not obvious are generally found in the debugging menu. Values are encoded as an unsigned 32 bit number for all results. + +1. Live temperature (In C) +2. Live set point +3. DC input voltage +4. Handle temperature (In C) +5. Power level +6. Power source +7. Tip resistance +8. uptime +9. Time of last movement +10. Maximum temperature settable +11. Raw tip reading +12. Hall sensor +13. Operating mode +14. Estimated wattage + +### Settings + +`UUID: f6d80000-5a10-4eba-AA55-33e27f9bc533` + +The settings service has two special entries; for saving and resetting settings. +Otherwise all settings are enumerated using UUID's of the format : `f6d7ZZZZ-5a10-4eba-AA55-33e27f9bc533))` where `ZZZZ` is the setting number as matched from [Settings.h](https://github.com/Ralim/IronOS/blob/dev/source/Core/Inc/Settings.h#L16). + +All data is read and written in fixed unsigned 16 bit numbers. + +#### Settings save + +To save the settings write a `0x0001` to `f6d7FFFF-5a10-4eba-AA55-33e27f9bc533`. +Its advised to not save settings on each change but instead to give the user a save button _or_ save after a timeout. This is just to reduce write cycles on the internal flash. + +#### Settings reset + +To reset all settings to defaults; write a `0x0001` to `f6d7FFFE-5a10-4eba-AA55-33e27f9bc533`. +This will reset settings immediately. + +### Bulk + +`UUID: 9eae1000-9d0d-48c5-AA55-33e27f9bc533` + +The bulk endpoint is where extra data is located with varying read sizes. + +#### Live data + +The bulk live data endpoint provides all of the data provided in the live endpoint, as one large single-read binary blob. This is designed for applications that are showing large amounts of data as this is more efficient for reading. + +#### Accelerometer Name + +_Not yet implemented_ + +#### Build ID + +This encodes the current build ID to allow viewing and handling when the BLE format changes. + +#### Device Serial Number + +This is generally the device CPU serial number. For most devices this can be used as an ID. On PinecilV2 its the MAC address. + +#### Device Unique ID + +This is only relevant on the PinecilV2. This is a random ID that is burned in at the factory. This is used by the online authenticity checker tool. diff --git a/Documentation/Troubleshooting.md b/Documentation/Troubleshooting.md index 7f4c8bb4..1c9ef0eb 100644 --- a/Documentation/Troubleshooting.md +++ b/Documentation/Troubleshooting.md @@ -14,6 +14,18 @@ But it is helpful to do some basic diagnostics first just in case the issue is e The **VAST** majority of issues are poor soldering or cold solder joints. If you can open up your iron, give it a good look at all the connection points, and use another iron to reflow any suspicious ones, this can fix most issues. +## Tip Shorted warning + +If you are powering up a device that supports tip resistance detection (TS101 and Pinecilv2 as of present), the firmware checks the readings of the raw tip resistance and sorts these into three "bins". `8 ohm tips`, `6.2 ohm tips` and `tip-shorted`. The tip resistance is used when negotiating USB-PD and in thermal calculations. +The `tip-shorted` option is selected if your tip is measured to be abnormally small. This could indicate a failed driver mosfet or a failed tip. + +When this warning is shown; heating will be disabled to protect from damage. As trying to heat a shorted tip can damage the iron itself. + +It is best to take out your tip and manually measure and verify the tip's resistance. It should be 6-8 ohms (depending on tip type). When measuring resistances this small some multimeters can struggle. If you have access to a current limited bench power supply, you can try doing a 4 wire measurement by measuring the voltage drop on the tip while applying a known current. `(R=V/I)`. + +If the tip measures correctly you may have a damaged driver mosfet; it would be ideal to open your iron and test the mosfet is operating correctly. +If after both of these checks everything looks as expected, feel free to open a discussion on IronOS to talk about the issue (Or for Pinecil the community chat can be a much faster response). + ## High tip temp reading when the tip is cool If you are finding the tip is reading high; the first fields to check in the Debug menu are `RTip` and `CHan`. diff --git a/Translations/translation_JA_JP.json b/Translations/translation_JA_JP.json index 5d669bb4..5d669bb4 100755..100644 --- a/Translations/translation_JA_JP.json +++ b/Translations/translation_JA_JP.json diff --git a/source/Core/BSP/BSP.h b/source/Core/BSP/BSP.h index db9f9814..626989fe 100644 --- a/source/Core/BSP/BSP.h +++ b/source/Core/BSP/BSP.h @@ -102,7 +102,10 @@ void setBuzzer(bool on); uint8_t preStartChecks();
uint8_t preStartChecksDone();
+// Check if the tip or output mosfet is shorted (if possible)
bool isTipShorted();
+// Show the boot logo
+void showBootLogo(void);
#ifdef __cplusplus
}
#endif
diff --git a/source/Core/BSP/MHP30/BSP.cpp b/source/Core/BSP/MHP30/BSP.cpp index ad3328f9..7d42019f 100644 --- a/source/Core/BSP/MHP30/BSP.cpp +++ b/source/Core/BSP/MHP30/BSP.cpp @@ -1,6 +1,7 @@ // BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Setup.h"
@@ -472,4 +473,6 @@ uint64_t getDeviceID() { uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
-uint8_t getTipInertia() { return TIP_THERMAL_MASS; }
\ No newline at end of file +uint8_t getTipInertia() { return TIP_THERMAL_MASS; }
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/BSP/MHP30/configuration.h b/source/Core/BSP/MHP30/configuration.h index 5d4c2eb1..c99afc64 100644 --- a/source/Core/BSP/MHP30/configuration.h +++ b/source/Core/BSP/MHP30/configuration.h @@ -164,13 +164,13 @@ #define HARDWARE_MAX_WATTAGE_X10 650 #define TIP_THERMAL_MASS 65 // TODO, needs refinement #define TIP_RESISTANCE 60 // x10 ohms, ~6 typical -#endif /* MHP30 */ +#endif /* MHP30 */ #ifdef ACCEL_EXITS_ON_MOVEMENT #define NO_SLEEP_MODE #endif -#define FLASH_LOGOADDR (0x08000000 + (62 * 1024)) +#define FLASH_LOGOADDR (0x08000000 + (126 * 1024)) #define SETTINGS_START_PAGE (0x08000000 + (127 * 1024)) #endif /* CONFIGURATION_H_ */ diff --git a/source/Core/BSP/Miniware/BSP.cpp b/source/Core/BSP/Miniware/BSP.cpp index fe0068be..f7e2053b 100644 --- a/source/Core/BSP/Miniware/BSP.cpp +++ b/source/Core/BSP/Miniware/BSP.cpp @@ -1,6 +1,7 @@ // BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Setup.h"
@@ -414,4 +415,6 @@ uint8_t getTipInertia() { #else
return TIP_THERMAL_MASS;
#endif
-}
\ No newline at end of file +}
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/BSP/Pinecil/BSP.cpp b/source/Core/BSP/Pinecil/BSP.cpp index ca9817f5..1c7a3888 100644 --- a/source/Core/BSP/Pinecil/BSP.cpp +++ b/source/Core/BSP/Pinecil/BSP.cpp @@ -1,6 +1,7 @@ // BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "IRQ.h"
#include "Pins.h"
@@ -97,4 +98,6 @@ bool isTipShorted() { return false; } uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
-uint8_t getTipInertia() { return TIP_THERMAL_MASS; }
\ No newline at end of file +uint8_t getTipInertia() { return TIP_THERMAL_MASS; }
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/BSP/Pinecilv2/BSP.cpp b/source/Core/BSP/Pinecilv2/BSP.cpp index 98476e07..35809866 100644 --- a/source/Core/BSP/Pinecilv2/BSP.cpp +++ b/source/Core/BSP/Pinecilv2/BSP.cpp @@ -1,6 +1,7 @@ // BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "IRQ.h"
#include "Pins.h"
@@ -10,6 +11,7 @@ #include "Utils.h"
#include "configuration.h"
#include "crc32.h"
+#include "hal_flash.h"
#include "history.hpp"
#include "main.hpp"
@@ -281,4 +283,11 @@ uint8_t getDeviceValidationStatus() { uint32_t programmedHash = EF_Ctrl_Get_Key_Slot_w1();
uint32_t computedHash = gethash();
return programmedHash == computedHash ? 0 : 1;
-}
\ No newline at end of file +}
+
+void showBootLogo(void) {
+ uint8_t scratch[1024];
+ flash_read(FLASH_LOGOADDR - 0x23000000, scratch, 1024);
+
+ BootLogo::handleShowingLogo(scratch);
+}
diff --git a/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld b/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld index 37165c60..2ae61c59 100644 --- a/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld +++ b/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld @@ -22,7 +22,7 @@ __EM_SIZE =8K; MEMORY { - xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1022K + xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1008K /*1024 - 8K header - 4K*2 for settings and logo*/ itcm_memory (rx) : ORIGIN = 0x22014000, LENGTH = 12K dtcm_memory (rx) : ORIGIN = 0x42014000, LENGTH = 8K ram_memory (!rx) : ORIGIN = 0x42016000, LENGTH = 72K diff --git a/source/Core/BSP/Pinecilv2/configuration.h b/source/Core/BSP/Pinecilv2/configuration.h index 686f54f5..9cc198b2 100644 --- a/source/Core/BSP/Pinecilv2/configuration.h +++ b/source/Core/BSP/Pinecilv2/configuration.h @@ -63,10 +63,10 @@ * OLED Brightness * */ -#define MIN_BRIGHTNESS 1 // Min OLED brightness selectable -#define MAX_BRIGHTNESS 101 // Max OLED brightness selectable -#define BRIGHTNESS_STEP 25 // OLED brightness increment -#define DEFAULT_BRIGHTNESS 26 // default OLED brightness +#define MIN_BRIGHTNESS 1 // Min OLED brightness selectable +#define MAX_BRIGHTNESS 101 // Max OLED brightness selectable +#define BRIGHTNESS_STEP 25 // OLED brightness increment +#define DEFAULT_BRIGHTNESS 26 // default OLED brightness /** * Temp change settings @@ -87,7 +87,7 @@ #define POWER_PULSE_DEFAULT 0 #else #define POWER_PULSE_DEFAULT 5 -#endif /* Pinecil */ +#endif /* Pinecil */ #define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s #define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms @@ -167,8 +167,10 @@ #define CANT_DIRECT_READ_SETTINGS #endif /* Pinecilv2 */ -#define FLASH_LOGOADDR (0x23000000 + (1022 * 1024)) -#define FLASH_PAGE_SIZE (1024) +#define FLASH_PAGE_SIZE (1024) // Read pages +// Erase is 4 or 8 k size, so we pad these apart for now +// If we ever get low on flash, will need better solution +#define FLASH_LOGOADDR (0x23000000 + (1016 * FLASH_PAGE_SIZE)) #define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr #endif /* CONFIGURATION_H_ */ diff --git a/source/Core/BSP/Sequre_S60/BSP.cpp b/source/Core/BSP/Sequre_S60/BSP.cpp index 14e9764b..25ad176e 100644 --- a/source/Core/BSP/Sequre_S60/BSP.cpp +++ b/source/Core/BSP/Sequre_S60/BSP.cpp @@ -1,6 +1,7 @@ // BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "HUB238.hpp"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
@@ -236,4 +237,6 @@ uint8_t preStartChecksDone() { return 1; } uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
uint8_t getTipInertia() { return TIP_THERMAL_INERTIA; }
-void setBuzzer(bool on) {}
\ No newline at end of file +void setBuzzer(bool on) {}
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index 97b0eddc..56dc6574 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -76,8 +76,7 @@ void startGUITask(void const *argument) { currentTempTargetDegC = min(sleepTempDegC, 75); } - BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); - + showBootLogo(); showWarnings(); if (getSettingValue(SettingsOptions::AutoStartMode)) { // jump directly to the autostart mode diff --git a/source/Makefile b/source/Makefile index 7ffa4b95..d1c123a8 100644 --- a/source/Makefile +++ b/source/Makefile @@ -407,7 +407,8 @@ DEVICE_BSP_DIR=./Core/BSP/Pinecilv2 S_SRCS:=$(shell find $(PINECILV2_DIR) -type d \( -path $(PINECILV2_VENDOR_BSP_COMMON_DIR) \) -prune -false -o -type f -name '*.S') $(info $(S_SRCS) )
ASM_INC=$(DEVICE_INCLUDES)
LDSCRIPT=./Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
-
+DEVICE_DFU_ADDRESS=0x23000000
+# DFU starts at the beginning of flash
# Flags
CPUFLAGS=-march=rv32imafc \
-mabi=ilp32f \
|