1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-21 22:08:08 +00:00

fix(core): set proper GPIO speeds for T3T1

[no changelog]
This commit is contained in:
tychovrahe 2024-03-07 14:13:34 +01:00 committed by TychoVrahe
parent 3c7cbdc47b
commit 39cfa7087a
2 changed files with 39 additions and 4 deletions

View File

@ -328,6 +328,7 @@ void display_setup_fmc(void) {
FMC_CONTINUOUS_CLOCK_SYNC_ONLY; FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
external_display_data_sram.Init.PageSize = FMC_PAGE_SIZE_NONE; external_display_data_sram.Init.PageSize = FMC_PAGE_SIZE_NONE;
#ifdef STM32F4
// reference RM0090 section 37.5 Table 259, 37.5.4, Mode 1 SRAM, and 37.5.6 // reference RM0090 section 37.5 Table 259, 37.5.4, Mode 1 SRAM, and 37.5.6
FMC_NORSRAM_TimingTypeDef normal_mode_timing = {0}; FMC_NORSRAM_TimingTypeDef normal_mode_timing = {0};
normal_mode_timing.AddressSetupTime = 5; normal_mode_timing.AddressSetupTime = 5;
@ -339,6 +340,34 @@ void display_setup_fmc(void) {
normal_mode_timing.AccessMode = FMC_ACCESS_MODE_A; normal_mode_timing.AccessMode = FMC_ACCESS_MODE_A;
HAL_SRAM_Init(&external_display_data_sram, &normal_mode_timing, NULL); HAL_SRAM_Init(&external_display_data_sram, &normal_mode_timing, NULL);
#else
external_display_data_sram.Init.ExtendedMode = FMC_EXTENDED_MODE_ENABLE;
FMC_NORSRAM_TimingTypeDef normal_mode_timing = {0};
normal_mode_timing.AddressSetupTime = 15;
normal_mode_timing.AddressHoldTime = 1; // don't care
normal_mode_timing.DataSetupTime = 11;
normal_mode_timing.BusTurnAroundDuration = 0; // don't care
normal_mode_timing.CLKDivision = 2; // don't care
normal_mode_timing.DataLatency = 2; // don't care
normal_mode_timing.DataHoldTime = 0;
normal_mode_timing.AccessMode = FMC_ACCESS_MODE_A;
FMC_NORSRAM_TimingTypeDef ext_mode_timing = {0};
ext_mode_timing.AddressSetupTime = 4;
ext_mode_timing.AddressHoldTime = 1; // don't care
ext_mode_timing.DataSetupTime = 5;
ext_mode_timing.BusTurnAroundDuration = 0; // don't care
ext_mode_timing.CLKDivision = 2; // don't care
ext_mode_timing.DataLatency = 2; // don't care
ext_mode_timing.DataHoldTime = 3;
ext_mode_timing.AccessMode = FMC_ACCESS_MODE_A;
HAL_SRAM_Init(&external_display_data_sram, &normal_mode_timing,
&ext_mode_timing);
#endif
} }
#ifdef FRAMEBUFFER #ifdef FRAMEBUFFER
@ -368,12 +397,18 @@ void display_init(void) {
backlight_pwm_init(); backlight_pwm_init();
#ifdef STM32F4
#define DISPLAY_GPIO_SPEED GPIO_SPEED_FREQ_VERY_HIGH
#else
#define DISPLAY_GPIO_SPEED GPIO_SPEED_FREQ_LOW
#endif
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
// LCD_RST/PC14 // LCD_RST/PC14
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStructure.Speed = DISPLAY_GPIO_SPEED;
GPIO_InitStructure.Alternate = 0; GPIO_InitStructure.Alternate = 0;
GPIO_InitStructure.Pin = GPIO_PIN_14; GPIO_InitStructure.Pin = GPIO_PIN_14;
// default to keeping display in reset // default to keeping display in reset
@ -384,7 +419,7 @@ void display_init(void) {
// LCD_FMARK (tearing effect) // LCD_FMARK (tearing effect)
GPIO_InitStructure.Mode = GPIO_MODE_INPUT; GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStructure.Speed = DISPLAY_GPIO_SPEED;
GPIO_InitStructure.Alternate = 0; GPIO_InitStructure.Alternate = 0;
GPIO_InitStructure.Pin = DISPLAY_TE_PIN; GPIO_InitStructure.Pin = DISPLAY_TE_PIN;
HAL_GPIO_Init(DISPLAY_TE_PORT, &GPIO_InitStructure); HAL_GPIO_Init(DISPLAY_TE_PORT, &GPIO_InitStructure);
@ -392,7 +427,7 @@ void display_init(void) {
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStructure.Speed = DISPLAY_GPIO_SPEED;
GPIO_InitStructure.Alternate = GPIO_AF12_FMC; GPIO_InitStructure.Alternate = GPIO_AF12_FMC;
// LCD_CS/PD7 LCD_RS/PD11 LCD_RD/PD4 LCD_WR/PD5 // LCD_CS/PD7 LCD_RS/PD11 LCD_RD/PD4 LCD_WR/PD5
GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_11 | GPIO_PIN_4 | GPIO_PIN_5; GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_11 | GPIO_PIN_4 | GPIO_PIN_5;

View File

@ -121,7 +121,7 @@ static inline void sdcard_active_pin_state(void) {
// configure SD GPIO // configure SD GPIO
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_PULLUP; GPIO_InitStructure.Pull = GPIO_PULLUP;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStructure.Alternate = GPIO_AF12_SDMMC1; GPIO_InitStructure.Alternate = GPIO_AF12_SDMMC1;
GPIO_InitStructure.Pin = GPIO_InitStructure.Pin =
GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12; GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;