Hi,
I genareted a basic test project with stm32MXcube. I2C is active only. But i can not debug this project. After remap command (__HAL_AFIO_REMAP_I2C1_ENABLE();) shutting down debug session.
MCU: STM32F103VCT6 Debugger: ST-LINK/V2
I am using this wires:
1-PA14/SWCLK 2-PA13/SWDIO 3-NRST 4-VDD 5-VSS
PB9/SDA PB8/SCL
If i don't use remap command ( PB7/SDA, PB6/SCL ) there is no any problem.
Please help me.
Thank you.
Hi, When i try debug "__HAL_AFIO_REMAP_I2C1_ENABLE();" line, debugger is disconnecting.
#define __HAL_AFIO_REMAP_I2C1_ENABLE() SET_BIT(AFIO->MAPR, AFIO_MAPR_I2C1_REMAP)
My all codes auto generated by STM32CubeMX. But I can not debug it.
HAL_MspInit function includes __HAL_RCC_AFIO_CLK_ENABLE() line command. HAL_I2C_MspInit function includes __HAL_AFIO_REMAP_I2C1_ENABLE() line command.
My CubeMX and Aouto generated Keil MDK5 Projects: yadi.sk/.../qxGw7dPW3EgrVz yadi.sk/.../qxGw7dPW3EgrVz
Firmware Package Name and Version: FW_F1 V1.4.0
MCU: STM32F103VCT6
Thank You
When i generate same project for STM32f103RBT6 using MXcube, the problem does not occur on STM32f103RBT6 board. But same code download to STM32F103VCT6 boards shutting down debug session. I have different STM32F103VCT6 boards. Thanks
I have a similar problem with a board with an STM32F100RC. The debugger stops when MX_I2C1_Init() is called.
__HAL_AFIO_REMAP_I2C1_ENABLE();
is expanded to
SET_BIT(AFIO->MAPR, AFIO_MAPR_I2C1_REMAP)
but the SET_BIT macro can't be called with the register AFIO->MAPR Bits 24-26 of this register are write only so you can't use a read/modify/write instruction on this register.
I solved the problem using this instruction instead:
AFIO->MAPR = (AFIO->MAPR & (!AFIO_MAPR_SWJ_CFG_Msk)) | AFIO_MAPR_SWJ_CFG_JTAGDISABLE | AFIO_MAPR_I2C1_REMAP;
Use at your own risk ;-)
P.S. or instead of SET_BIT/CLEAR_BIT a MODIFY_REG macro should always be used with register AFIO->MAPR