Skip to content

Commit

Permalink
stm32/h7: Fixed an issue with the naming of the D2CCIP2R selector con…
Browse files Browse the repository at this point in the history
…stant for some of the USARTs
  • Loading branch information
dragonmux committed Aug 11, 2024
1 parent aa4878d commit bfde640
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/libopencm3/stm32/h7/rcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ LGPL License Terms @ref lgpl_license
#define RCC_D2CCIP2R_I2C123SEL_SHIFT 12U
#define RCC_D2CCIP2R_RNGSEL_MASK 0x3U
#define RCC_D2CCIP2R_RNGSEL_SHIFT 8U
#define RCC_D2CCIP2R_USART16SEL_SHIFT 3U
#define RCC_D2CCIP2R_USART16910SEL_SHIFT 3U
#define RCC_D2CCIP2R_USART234578SEL_SHIFT 0U
#define RCC_D2CCIP2R_USARTSEL_MASK 7U

Expand Down
6 changes: 3 additions & 3 deletions lib/stm32/h7/rcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ uint32_t rcc_get_usart_clk_freq(uint32_t usart)
uint32_t clksel, pclk;
if (usart == USART1_BASE || usart == USART6_BASE) {
pclk = rcc_clock_tree.per.pclk2_mhz * HZ_PER_MHZ;;
clksel = (RCC_D2CCIP2R >> RCC_D2CCIP2R_USART16SEL_SHIFT) & RCC_D2CCIP2R_USARTSEL_MASK;
clksel = (RCC_D2CCIP2R >> RCC_D2CCIP2R_USART16910SEL_SHIFT) & RCC_D2CCIP2R_USARTSEL_MASK;
} else {
pclk = rcc_clock_tree.per.pclk1_mhz * HZ_PER_MHZ;
clksel = (RCC_D2CCIP2R >> RCC_D2CCIP2R_USART234578SEL_SHIFT) & RCC_D2CCIP2R_USARTSEL_MASK;
Expand Down Expand Up @@ -404,8 +404,8 @@ void rcc_set_peripheral_clk_sel(uint32_t periph, uint32_t sel) {
case UART9_BASE:
case USART10_BASE:
reg = &RCC_D2CCIP2R;
mask = RCC_D2CCIP2R_USARTSEL_MASK << RCC_D2CCIP2R_USART16SEL_SHIFT;
val = sel << RCC_D2CCIP2R_USART16SEL_SHIFT;
mask = RCC_D2CCIP2R_USARTSEL_MASK << RCC_D2CCIP2R_USART16910SEL_SHIFT;
val = sel << RCC_D2CCIP2R_USART16910SEL_SHIFT;
break;
case USART2_BASE:
case USART3_BASE:
Expand Down

0 comments on commit bfde640

Please sign in to comment.