Bug STM32F107RCTx SPI REMAPPED NOT WORK
STM32Cube FW_F1 V1.8.4
Conditions:
SPI1 or SPI3 remapped to PB3-5 pins.
Problem:
SPI not work.
Solution:
Enable Debug Serial Wire (PA13 PA14)
SWJ function changes SWJ_CFG[2:0] bits
stm32f1xx_hal_msp.c line 81
__HAL_AFIO_REMAP_SWJ_NOJTAG();
do{ uint32_t tmpreg = ((AFIO_TypeDef *)((0x40000000UL + 0x00010000UL) + 0x00000000UL))->MAPR; \
tmpreg &= ~(0x7UL << (24U)); \
tmpreg |= (0x1UL << (25U)); \
((AFIO_TypeDef *)((0x40000000UL + 0x00010000UL) + 0x00000000UL))->MAPR = tmpreg; \
}while(0u)
For some reasons SPI remap function changes SWJ_CFG[2:0] bits too, somehow it depend on previous state of SWJ_CFG.
stm32f1xx_hal_msp.c line 121
__HAL_AFIO_REMAP_SPI1_ENABLE();
do{ uint32_t tmpreg = ((AFIO_TypeDef *)((0x40000000UL + 0x00010000UL) + 0x00000000UL))->MAPR; \
tmpreg |= (0x7UL << (24U)); \
tmpreg |= (0x1UL << (0U)); \
((AFIO_TypeDef *)((0x40000000UL + 0x00010000UL) + 0x00000000UL))->MAPR = tmpreg; \
}while(0u)
