2015-11-18 03:26 AM
Dear all,
My development environments are as followings, - STM32F103VET7 - IAR EWARM - STLink/V2 & SWD connection Program download and ''go'' are no problem. But I always failed to stop debugging with communication error message(Target is running, Failed to stop the Target). I tried to find the position where debugger lost the connection and found it as below. __HAL_AFIO_REMAP_CAN1_2() of HAL_CAN_MspInit(); &sharpdefine __HAL_AFIO_REMAP_CAN1_2() MODIFY_REG(AFIO->MAPR, AFIO_MAPR_CAN_REMAP, AFIO_MAPR_CAN_REMAP_REMAP2) The macro is just for AFIO_MAPR remapping(PB8, PB9 for CAN1). I cannot understand why it casued brake debugger connection. If I deleted the line as temporary, ''debugging stop & go'' is possible , but failed to use BxCAN1. Please help me... #swd #stm32 #bxcan #debugger2015-11-18 05:57 AM
I guess you'd need to double check the defines, and the register they are acting upon, and confirm what's actually being done in the Reference Manual. There are plenty of bugs in the HAL waiting to be discovered.
2015-11-18 06:08 AM
kim.jc
Try to remap CAN before switching to SWD. I had a simular problem with SPI1 remap2015-11-18 06:26 AM
Hi kim.jc,
In the project available under ''STM32Cube_FW_F1_V1.2.0\Projects\STM3210E_EVAL\Examples\CAN\CAN_Networking'', there is a call for __HAL_AFIO_REMAP_CAN1_2. I tested this project and I didn't faced any issue.Could you please do the same and let me know if you still have same problem?-Mayla-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.
2015-11-18 04:05 PM
Wow !!
Thank a lot for your coonsideration. As your recommend, I tried to change the location of can port remap. But I couldn't get a correct operation. Anyway, If i delete __HAL_AFIO_REMAP_SWJ_NOJTAG() in HAL_MspInit(), everything is OK. //__HAL_AFIO_REMAP_SWJ_NOJTAG(); Repeatly speaking, thank p.denis very much. BR, JC Kim2016-08-30 09:19 PM
Hi,
I have the same problem. in my code the__HAL_AFIO_REMAP_SWJ_NOJTAG();
changes the AFIO>MPR register value to 0x04000000 instead of 0x02000000!!!
any suggestion?
Thanks,
Misagh
2016-12-21 01:14 AM
Hi! I found same error with reading different values from this register. I even tried to read/write values as pointer to (volatile uint32_t).