cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrectly written AFIO_MAPR.SWJ_CFG bits in CubeF1/LL

In stm32f1xx_ll_gpio.h, LL_GPIO_AF_EnableRemap_SWJ(), LL_GPIO_AF_Remap_SWJ_NONJTRST, LL_GPIO_AF_Remap_SWJ_NOJTAG(), LL_GPIO_AF_DisableRemap_SWJ() all use

SET_BIT(AFIO->MAPR, AFIO_MAPR_SWJ_CFG_xxxxx);

which is incorrect, as SET_BIT is

#define SET_BIT(REG, BIT) ((REG) |= (BIT))

and the read value of AFIO_MAPR.SWJ_CFG field according to RM0008 is unpredictable.

JW

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hi @Community member​ ,

Thank you for bringing this issue to our attention.

I raised this internally along to our development team for fix.

Internal ticket number: 138603 is created (PS: this is an internal tracking number and is not accessible or usable by customers).

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

6 REPLIES 6
Imen.D
ST Employee

Hi @Community member​ ,

Thank you for bringing this issue to our attention.

I raised this internally along to our development team for fix.

Internal ticket number: 138603 is created (PS: this is an internal tracking number and is not accessible or usable by customers).

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Thanks, Imen!

Jan

@Imen DAHMEN​ 

Hi Imen,

Do folks who look at these tickets have also access/willing to look at the threads here? In other words, does posting additional related information/questions here make sense?

In particular, as brought up by @Richard Jones​ on January 25, 2018 at 12:26, the following two things are in contradiction to each other:

0693W00000WIAp8QAH.png 

As the LL library already uses the "other combination" presumably with "no effect", it appears that the "forbidden" in the table is incorrect. Can this please be clarified once for all, too?

Thanks,

Jan

@Imen DAHMEN​ 

Hi @Imen.D ,

I've submitted the issue brought up by original post at github.

However, can you please have a look at the documentation issue from the second post?

Thanks,

JW

Imen.D
ST Employee

Hi @waclawek.jan ,

1- The Serial wire JTAG configuration APIs was already updated in the latest release of CubeF1 (V1.8.5) to use MODIFY_REG() instead of CLEAR_BIT() / SET_BIT() macros, as follow:

 

 

__STATIC_INLINE void LL_GPIO_AF_Remap_SWJ_NONJTRST(void)
{
MODIFY_REG(AFIO->MAPR, AFIO_MAPR_SWJ_CFG, AFIO_MAPR_SWJ_CFG_NOJNTRST);
}

 

 

The other remap API's the AFIO_MAPR_SWJ_CFG bits are forced to 1 by default to avoid unpredictable SWJ_CFG bits. Example the LL_GPIO_AF_Remap_TIM2ITR1_TO_USB() API:

 

 

__STATIC_INLINE void LL_GPIO_AF_Remap_TIM2ITR1_TO_USB(void)
{
SET_BIT(AFIO->MAPR, AFIO_MAPR_TIM2ITR1_IREMAP | AFIO_MAPR_SWJ_CFG);
}

 

 

2- I highlighted internally your reported doc limitation in the internal ticket number 173730 to push for RM0008 update and enhance the documentation errata correction.

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Thanks, @Imen.D 

JW