Commit Graph

254 Commits

Author SHA1 Message Date
bleska
c6bdec5b77 refactor(core): dma2d_wait() busy wait removal
dma_transfer_in_progress boolean variable has been added for tracking of dma2d current state (transferring/idle). The variable is set after dma2d successful transfer start and cleared inside the dma2d_wait() function after the dma2d transfer has finished.

dma2d_wait() function has been refactored from HAL based busy waiting variant to a priodical polling of dma2d status flags (TC, TE, CE) and sleep/wake concept using the dma2d to wake MCU when such event occurs.

WFE (Wait For Event) instruction is used for MCU sleep entry. The "SCB.SCR.SEVONPEND" bit is used to enable MCU wake-up with NVIC disabled IRQs.

[no changelog]
2026-02-17 13:36:54 +01:00
bleska
36811b9616 refactor(core): dma2d_wait() busy wait removal
Removing the "KERNEL_MODE" guards as the whole file is guarded. Removing the dma2d_wait() function call as it's called twice in the near location.

[no changelog]
2026-02-17 13:36:54 +01:00
bleska
4e19779310 fix(core): PLL_DSI_NDIV wrongly set for DISC2
The PLL_DSI_NDIV macro has been redefined to be calculated out of the other PLL_DSI parameters and the HSE_VALUE.

[no changelog]
2026-02-16 11:18:14 +01:00
cepetr
a0bbfe819f refactor(core): improve app_loader error handling
[no changelog]
2026-02-09 12:16:54 +01:00
cepetr
ec392659fd refactor(core): simplify reconfiguration of MPU for systask
[no changelog]
2026-02-09 12:16:54 +01:00
cepetr
b4a58ddebd fix(core): call SDL drawing function in kernel task context
[no changelog]
2026-02-06 09:49:58 +01:00
bleska
5ba0333910 feat(core): TS7 display refresh rate scaling and configuration optimization
In order to lower the power consumption in standard operation mode, the goal is to regulate the display refresh rate based on the current needs (animations - 60Hz, static images - 30 Hz).
 - Introduction of the on-the-fly refresh rate change functionality (interrupt based).

Configuration optimizations' investigations:
 - Since the display visible dimensions are 520x380 and the display controller doesn't support this resolution directly, the closest variant 520x480 is used with 50px offset. Changing the resolution used to 520x430 and shortening the HACT region by 50px effectivly increasing the blanking period.
 - Using RGB565 DSI color format, changing pixel clock to 15.5 MHz, changing HFP to 20 to maintain the 60 Hz refresh rate for the new pixel clock.
 - DSI lane byte clock vs LTDC pixel clock ratio (max, min) tests.
 - Etc. - different configuration profiles have been tested and TS7 input power consumption measured.

Formalizing the code to official one:
 - adding preprocessor definitions to panels' configuration header files
 - adding ifdefs to display_driver and display_fb source files to integrate the refresh rate scaling code based on panel's used
 - the refresh rate change is to be performed to high one as soon as new image is to be shown, and to the low one after a timeout expires

[no changelog]
2026-02-05 14:26:07 +01:00
bleska
b82f59990f refactor(core): panel configuration refactoring.
The arguments' passed to the HAL_DSI_LongWrite() function calls were corrected. Since the code is used in "KERNEL_MODE" => adding the respective preprocessor directives.

[no changelog]
2026-02-05 14:26:07 +01:00
bleska
858e928778 refactor(core): buffer usage check refactoring
Improving the code legibility of pwm_data[] buffer usage check.

[no changelog]
2026-02-03 17:37:38 +01:00
bleska
3706a65363 fix(core): pwm_data[] buffer clear check fix
A bug in pwm_data[] buffer clear check has been found and fixed. The pwm_data[][1] array element is used when the respective buffer is used for setting of new pulses' value to TPS61062 IC.

[no changelog]
2026-02-03 17:37:38 +01:00
kopecdav
e64bddf7d0 feat(core): Add battery cycles updates into device telemetry.
[no changelog]
2026-01-23 12:54:34 +01:00
kopecdav
eacf156a3b fix(core): remove auxiliary casting in battery increment fetching.
[no changelog]
2026-01-23 12:54:34 +01:00
tychovrahe
04691ffc35 fix(core): fix always active power management errors in emulator
[no changelog]
2026-01-20 09:06:12 +01:00
tychovrahe
3a134af42c fix(core): update battery temp in telemetry only if NTC is connected
[no changelog]
2026-01-19 12:58:56 +01:00
tychovrahe
dddef12583 feat(core): add telemetry logging of battery errors
[no changelog]
2026-01-19 12:58:56 +01:00
tychovrahe
bce05409a1 feat(core): detect battery disconnection
[no changelog]
2026-01-19 12:19:22 +01:00
kopecdav
45eb11673d feat(core): introduce battery cycle counter.
[no changelog]
2026-01-19 10:59:38 +01:00
kopecdav
7591441a5e refactor(core): remove auxiliary variable.
[no changelog]
2026-01-19 10:59:38 +01:00
kopecdav
7e85c0518e refactor(core): encapsulate fuel_gauge and battery model under single API.
[no changelog]
2026-01-19 10:59:38 +01:00
cepetr
c0de3d9ee5 feat(core): introduce app_loader/cache module
[no changelog]
2026-01-16 09:20:57 +01:00
cepetr
048f517b5f fix(core): remove unnecessary exit handlers
[no changelog]
2026-01-16 09:20:57 +01:00
cepetr
7cf653c258 refactor(core): move telemetry to sec layers
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
521cdb2e0e refactor(core): split and move suspend module into io and sec layers
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
f0d12275d3 refactor(core): move rsod to io/gfx and sec/rsod
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
47a7ba723f refactor(core): move gfx to io/gfx
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
cd8b7b62d6 refactor(core): move translatations module to io layer
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
01da364328 refactor(core): move i2c_bus driver to sys layer
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
272730b424 refactor(core): move tsqueue to io layer
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
5df2ecdff2 refactor(core): move unit_properties to sec layer
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
5b63706d11 refactor(core): move notify module to io layer
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
2761e69f8d refactor(core): split rng module into sys/rng and sec/rng_strong
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
638f0cb436 refactor(core): move power_manager from sys to io
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
cb1b9cc474 refactor(core): move backup_ram driver from sys to sec
[no changelog]
2026-01-13 11:18:26 +01:00
cepetr
1a37ddf1b9 refactor(core): remove circular deps between rtl and sys
[no changelog]
2026-01-13 11:18:26 +01:00
kopecdav
2caaca62ff feat(core): Add error handling in driver init functions + update syscall stubs.
[no changelog]
2026-01-12 16:11:46 +01:00
kopecdav
ca5b40837f feat(core): rework haptic driver.
Major rework of the haptic driver to improve the haptic feedback of the T3W1 click
- Rename driver from `drv2625` to `drv262x`, since we use it to control compatible models drv2624 and drv2625
- Fix driver configuration to properly configure close loop and open loop operation. T3W1 driver was configured to work in close_loop mode.
- Add waveform playbacks on drv2624 + new button click haptic effect
- Update actuator configuration files with more control parameters.
- Add error handling  and tidy up the driver API comments.
- Removed `haptic_test` function since it could be directly replaced with `haptic_play_custom`

[no changelog]
2026-01-12 16:11:46 +01:00
cepetr
a1fa1fbbdb refactor(core): use LOG macros instead of printfs
[no changelog]
2025-12-12 15:18:35 +01:00
bleska
00bc9339cc feat(core): implementation of nRF FW version readout via SMP commands for realiability increase e.g. for cases when the nRF FW application is broken from whatever reason and can't reply to Trezor's FW version check for possible nRF FW update.
The alternative way of FW version readout uses the MCUboot SMP serial recovery feature which had already been enabled and used for nRF FW update in the field mainly. The version is returned as a structure of 4 uint fields representing major, minor, revision and build_num respectively (string received from nRF IC is decoded).
The development releases of nRF FW are to be built with: "./scripts/build_sign_flash.sh -b t3w1_revA_nrf52832/nrf52832 -c -d -s -f" command. '-d' is essential, with '-p' the build script generates and signs the image in a way that MCUboot can't verify that (it uses debug keys see hash_signer.py but the MCUboot expects the production key which has embedded inside "image_validate.c" file).

[no changelog]
2025-12-11 16:40:08 +01:00
cepetr
592b346e4a feat(core): improve trustzone settings
[no changelog]
2025-12-03 15:30:44 +01:00
cepetr
35fa1ab000 refactor(core): move HSI initialization to sysmon
[no changelog]
2025-12-03 15:30:44 +01:00
tychovrahe
d8c727ef47 fix(core/emulator): start BLE driver in enabled state by default
[no changelog]
2025-12-01 10:16:02 +01:00
Martin Milata
d1fdcf57ee build(core): fix emulator build on macOS
[no changelog]
2025-11-10 18:42:50 +01:00
Roman Zeyde
22f1b480d4 chore(core): fix a small typo
[no changelog]
2025-10-31 09:30:31 +01:00
tychovrahe
20dfec514d feat(core): respect BLE settings in bootloader 2025-10-30 14:04:24 +01:00
Martin Milata
4cac742c3a refactor(core): emulator socket handling
[no changelog]
2025-10-29 21:18:32 +01:00
Martin Milata
e2f3e3b0fa feat(core): add emulated BLE interfaces
[no changelog]
2025-10-29 21:18:32 +01:00
bleska
eae704da9d feat(core): implementation of backlight brightness correction.
Constants' re-calculation so that the physical brightness remains static between the old and new approach. It should minimize the effect  of the new approach for user, tests at production line, etc.

[no changelog]
2025-10-27 20:18:39 +01:00
bleska
56c91cc95d feat(core): implementation of backlight brightness correction.
Having re-considered that, the gamma correction function shall stay in the backlight driver's level. Although, not the GAMMA EXPONENT. The exponent is to be passed as an argument to backlight_init() function either to be used/not_used further on. This exponent shall be defined for different displays separately in their respective header files.

[no changelog]
2025-10-27 20:18:39 +01:00
bleska
9f6f78a04a feat(core): implementation of backlight brightness correction.
First PoC implemented at TS7, specifically for tps61062 boost LED driver IC. Next step will be to make it general i.e. to move the correction to display driver SW level rather than backlight's one.

[no changelog]
2025-10-27 20:18:39 +01:00
cepetr
c210d952a5 fix(core): fix missing TOUCH_END in touch driver 2025-10-27 18:44:23 +01:00