cancel
Showing results for 
Search instead for 
Did you mean: 

Issues when setting SWJ_CFG in AFIO->MAPR to SWJ_NOJTAG

kraske
Associate
Posted on October 07, 2016 at 08:39

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on April 13, 2018 at 08:49

Hi,I found the problem was solved in new version.Thanks !

View solution in original post

5 REPLIES 5
Walid FTITI_O
Senior II
Posted on October 07, 2016 at 11:00

Hi kraske.robert, 

Thanks for the feedback. I submit a request internally for investigation in this subject.

-Hannibal-

Dmitry Novikov
Associate II
Posted on December 21, 2016 at 09:20

Hi, I have same error with F100 MCU.

https://community.st.com/0D50X00009XkYWnSAN

 
Jalon Wong
Associate II
Posted on March 20, 2018 at 03:55

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)

Posted on March 22, 2018 at 15:04

Hello

jalonwong

,

Please usethenew patch for STM32CubeF1 Firmware Package v1.6.1 and let me know if this problemexists.

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on April 13, 2018 at 08:49

Hi,I found the problem was solved in new version.Thanks !