2015-03-04 02:46 PM
I tried
to configure the
CAN
controller
in the
STM32F042F6P6
using
STM32CubeMX.The function
was not
correctbecause
it
was not
properly
remapping
pins
PA11
, PA12.Macro
__HAL_REMAP_PIN_ENABLE
doesnot
activate
SYSCFGCOMPEN
:SYSCFG
&
COMP
clock
enable
.Version: STM32CubeMX
4.6.0
,STM32CubeF0
1.2.1I
made a change
in the file
stm32f0xx_hal_msp.c,
function is
correct now:
HAL_MspInit
void
(void
){
/
*
USER
CODE
BEGIN
MspInit
0
*
/
RCC-
>APB2ENR
=
0x00000001
;/
*
<<<<
Correction
,added
*
/
/
*
END
USER
CODE
MspInit
0
*
/
/
*
Init
System
interrupt
*
/
/
*
SysTick_IRQn
interrupt
configuration
*
/
HAL_NVIC_SetPriority
(
SysTick_IRQn,0
,0
);__HAL_REMAP_PIN_ENABLE
(
HAL_REMAP_PA11_PA12);/
*
USER
CODE
BEGIN
MspInit
1
*
/
/
*
END
USER
CODE
MspInit
1
*
/
}
#stm32cubef0-bug-__hal_remap_pin_2015-03-04 04:03 PM
RCC-
>APB2ENR
=
0x00000001
;/
*
<<<<
Correction
,added
*
/
Don't assume to know initial conditions, or break them, useRCC-
>APB2ENR
|=
0x00000001
;/
*
<<<<
Correction
,added
*
/
2015-03-05 12:38 AM
Of course, you
're right.This is
more
secure solution.