2015-04-03 06:00 PM
hi
i'm pretty new to stm32, and even newer to the stm32cube HAL code generation.i tried to configure it for an stm32f103cb device but with PB3/PB4 used for GPIO instead of the standard JTAG signals.the generated code includes a call to __HAL_AFIO_REMAP_SWJ_NOJTAG() in HAL_MspInit(). however, at this stage, SystemClock_Config() is not called yet. more important, i think __HAL_RCC_AFIO_CLK_ENABLE() is not called yet. thus,__HAL_AFIO_REMAP_SWJ_NOJTAG() has no effect and PB3/PB4 do not function as GPIO.
if i made another call to__HAL_AFIO_REMAP_SWJ_NOJTAG() just after
__HAL_RCC_AFIO_CLK_ENABLE(), then all is working normally.
so, is there a bug in the code generator in that it is trying to set AFIO->MAPR before the AFIO clock is set up? (i would guess that's not supposed to happen).thanks2015-04-08 12:11 AM
__HAL_RCC_AFIO_CLK_ENABLE().
This should be fixed in a future release.