cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE and STM32Cube FW_F1 V1.8.5 firmware Package , SWJ problem.

FAndr.5
Associate III

IDE : STM32CubeIDE Version 1.12.1
firmware Package: FW_F1 V1.8.5

Device : STM32F103C8T6

I found that when I set MX -> Pinout & Configuration -> System Core -> Sys -> Debug = No Debug, I can't use some pins, especially those associated with JTAG.

I discovered that in the file stm32f1xx_hal_msp.c the HAL_MspInit function does not put __HAL_AFIO_REMAP_SWJ_DISABLE to configure the AFIO_MAPR register (SWJ_CFG) and this register in the STM32F103C8T6 after the reset is put in Full SWJ mode (JTAG-DP + SW-DP) (information obtained from section 9.4.2 of the RM0008 manual. )

I force the code as follows:

void HAL_MspInit(void)
{
/* USER CODE BEGIN MspInit 0 */

/* USER CODE END MspInit 0 */

__HAL_RCC_AFIO_CLK_ENABLE();
__HAL_RCC_PWR_CLK_ENABLE();

/* System interrupt init*/

/* Peripheral interrupt init */
/* PVD_IRQn interrupt configuration */
HAL_NVIC_SetPriority(PVD_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(PVD_IRQn);

/* USER CODE BEGIN MspInit 1 */
#if defined(RELEASE_VERSION)
__HAL_AFIO_REMAP_SWJ_DISABLE(); // I think this line should be generated by itself if I set Debug = No Debug.
#endif
/* USER CODE END MspInit 1 */
}

With that I manage to make the pins functional as GPIO.

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hi @FAndr.5 ,

Please note that reported issue should be already fixed with latest STM32CubeMX revision (6.10.0) already available on st.com.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Amel NASRI
ST Employee

Hi @FAndr.5 ,

Thanks for bringing this issue to our attention, it is reported internally and sorry for late answer.
Internal ticket number: 160875 (This is an internal tracking number and is not accessible or usable by customers).

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Amel NASRI
ST Employee

Hi @FAndr.5 ,

Please note that reported issue should be already fixed with latest STM32CubeMX revision (6.10.0) already available on st.com.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.