Skip to content

Commit

Permalink
cpu/stm32_common: preserve JTAG pins on L1
Browse files Browse the repository at this point in the history
  • Loading branch information
olegart authored and fjmolinas committed May 6, 2019
1 parent bc43e8c commit 92d9d23
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions cpu/stm32_common/cpu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,25 @@ void cpu_init(void)
/* can't be more than 12 ports on STM32L1 */
for (int i = 0; i < 12; i++) {
port = (GPIO_TypeDef *)(GPIOA_BASE + i*(GPIOB_BASE - GPIOA_BASE));
if (IS_GPIO_ALL_INSTANCE(port))
port->MODER = 0xffffffff;
else
if (IS_GPIO_ALL_INSTANCE(port)) {
#if !defined (DISABLE_JTAG)
switch (i) {
/* preserve JTAG pins on PORTA and PORTB */
case 0:
port->MODER = 0xABFFFFFF;
break;
case 1:
port->MODER = 0xFFFFFEBF;
break;
default:
port->MODER = 0xFFFFFFFF;
break;
}
#else
port->MODER = 0xFFFFFFFF;
#endif
}
else {
break;
}
/* restore GPIO clock */
Expand Down

0 comments on commit 92d9d23

Please sign in to comment.