Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

echoplayer: modify LCD timings to disable PLL3 fractional mode

According to the datasheet, the PLL fractional mode is
apparently not supported in the medium VCO range.

The LCD isn't picky about front/back porch settings so
modify these to get a dot clock close to 6 MHz (within
~0.1% error).

Change-Id: I51647534db8c2b261391864db9262a0b04548e6d

authored by

Aidan MacDonald and committed by
Solomon Peachy
b155e2c3 fe0c404d

+11 -13
+8 -10
firmware/target/arm/stm32/echoplayer/clock-echoplayer.c
··· 28 28 #include "regs/stm32h743/syscfg.h" 29 29 30 30 #define PLL1Q_FREQ 48000000 31 + #define PLL3R_FREQ 6000000 31 32 32 33 /* Flag to use VOS0 */ 33 34 #define STM32H743_USE_VOS0 (CPU_FREQ > 400000000) ··· 44 45 /* For simplicity, PLL parameters are hardcoded */ 45 46 _Static_assert(STM32_HSE_FREQ == 24000000, 46 47 "HSE frequency not correct"); 47 - _Static_assert(LCD_DOTCLOCK_FREQ == 6199200, 48 - "PLL3 parameters not correct for dot clock"); 48 + _Static_assert(LCD_DOTCLOCK_FREQ <= PLL3R_FREQ, 49 + "PLL3R too slow for LCD"); 49 50 _Static_assert(PLL1Q_FREQ == 48000000, 50 51 "PLL1Q parameters not correct"); 51 52 52 53 /* 53 54 * Use HSE/4 input for PLL1 54 - * Use HSE/16 input for PLL3 55 + * Use HSE/12 input for PLL3 55 56 * PLL2 reserved for audio; configured in target PCM code 56 57 */ 57 58 reg_writef(RCC_PLLCKSELR, 58 59 PLLSRC_V(HSE), 59 60 DIVM1(4), 60 61 DIVM2(0), 61 - DIVM3(16)); 62 + DIVM3(12)); 62 63 63 64 /* Enable PLL1P, PLL1Q, PLL3R */ 64 65 reg_writef(RCC_PLLCFGR, ··· 84 85 DIVQ(10 - 1), /* 480 / 10 = 48 MHz */ 85 86 DIVR(1 - 1)); 86 87 87 - reg_writef(RCC_PLL3FRACR, FRACN(1468)); 88 88 reg_writef(RCC_PLL3DIVR, 89 - DIVN(161 - 1), /* approx 241.768 MHz */ 89 + DIVN(90 - 1), /* 2 * 90 = 180 MHz */ 90 90 DIVP(1 - 1), 91 91 DIVQ(1 - 1), 92 - DIVR(39 - 1)); /* approx 6.1992 MHz */ 93 - 94 - reg_writef(RCC_PLLCFGR, PLL3FRACEN(1)); 92 + DIVR(30 - 1)); /* 180 / 30 = 6 MHz */ 95 93 96 94 reg_writef(RCC_CR, PLL1ON(1), PLL3ON(1)); 97 95 while (!reg_readf(RCC_CR, PLL1RDY)); ··· 191 189 }; 192 190 193 191 const struct stm32_clock ltdc_ker_clock = { 194 - .frequency = LCD_DOTCLOCK_FREQ, 192 + .frequency = PLL3R_FREQ, 195 193 .en_reg = ITA_RCC_APB3ENR, 196 194 .en_bit = BM_RCC_APB3ENR_LTDCEN, 197 195 .lpen_reg = ITA_RCC_APB3LPENR,
+3 -3
firmware/target/arm/stm32/echoplayer/lcd-echoplayer.h
··· 24 24 #include "config.h" 25 25 26 26 /* Hsync pulse width in units of dot clocks */ 27 - #define LCD_HSW 10 27 + #define LCD_HSW 14 28 28 29 29 /* Hsync back porch in units of dot clocks */ 30 - #define LCD_HBP 20 30 + #define LCD_HBP 7 31 31 32 32 /* Horizontal active width in units of dot clocks */ 33 33 #define LCD_HAW LCD_WIDTH 34 34 35 35 /* Hsync front porch in units of dot clocks */ 36 - #define LCD_HFP 10 36 + #define LCD_HFP 7 37 37 38 38 /* Vsync pulse height in units of horizontal lines */ 39 39 #define LCD_VSH 2