2016-10-06 11:39 PM
I'm using the STM32F103.
Setting the controller to __HAL_AFIO_REMAP_SWJ_NOJTAG on startup. Which means I want to use only the SW pins and the port pins PA15, PB3 and PB4 should be normal IO pins. I observed the following problem: Unfortunately the related bits in AFIO->MAPR are write only. Reading these three bits is undefined. In fact, depending on the settings of AFIO->MAPR I observed that a 0x4 is read back if a 0x2 was written. So far it is ok as we can't rely on the read bits. Unfortunately the code in stm32f1xx_hal_gpio_ex.h relies on these read back bits of SWJ_CFG. This is the case in all of the macros which uses MODIFY_REG(AFIO->MAPR... These macros reads back AFIO_MAPR. When reading back AFIO_MAPR you also read back the undefined bits of SWJ_CFG. And when writing back to AFIO_MAPR, you write a different (or wrong) value into SWJ_CFG.Solved! Go to Solution.
2018-04-13 01:49 AM
Hi,I found the problem was solved in new version.Thanks !
2016-10-07 02:00 AM
Hi kraske.robert,
Thanks for the feedback. I submit a request internally for investigation in this subject.-Hannibal-2016-12-21 12:20 AM
Hi, I have same error with F100 MCU.
2018-03-19 07:55 PM
I also have this problem and I found this problem affects not only MODIFY_REG(AFIO->MAPR but also SET_BIT(AFIO->MAPR, e.g. #define __HAL_AFIO_REMAP_USART1_ENABLE() SET_BIT(AFIO->MAPR, AFIO_MAPR_USART1_REMAP)
2018-03-22 08:04 AM
Hello
jalonwong
,Please usethenew patch for STM32CubeF1 Firmware Package v1.6.1 and let me know if this problemexists.
Best Regards,
Imen
2018-04-13 01:49 AM
Hi,I found the problem was solved in new version.Thanks !