Skip to main content
Visitor II
July 28, 2023
Solved

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

  • July 28, 2023
  • 2 replies
  • 10320 views

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.

    This topic has been closed for replies.
    Best answer by Amel NASRI

    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

    2 replies

    Technical Moderator
    September 6, 2023

    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

    Technical Moderator
    November 30, 2023

    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