2020-06-04 12:09 AM
Dear experts,
my STM32F042G6 is unexpectedly reset after I switched on fly CAN_TX GPIO to output GPIO pin.
for this I did this steps.
1).HAL_CAN_STOP() and then
2). GPIOA->MODER &= ~((U32) "pinX");
GPIOA->MODER|= ~(U32) "pinX");
I have also made the following steps.
1) . HAL_CAN_DeInit(hcan)
2) . HAL_GPIO_Init(x_GPIO_Port, &GPIO_InitStruct);
the result is the same.
I have looked at the reset register (RCC->CSR). I can't find any difference to normal power on .
after Reading (RCC->CSR) i become this Value : 0x0c80 0000
that mean :
1) Bit 27 PORRSTF: POR/PDR reset flag
2) Bit 26 PINRSTF: PIN reset flag
3) Bit 23 V18PWRRSTF: Reset flag of the 1.8 V domain.
also set a little breakpoint before changing GPIO mode and go through the lines Step over then there will be no reset.
but if I am in debug mode without breakpoint but through GPIO change debugging tool breaks.
maybe somebody has an idea why this reset happens or how I can find out what he is causing the reset.
thank you
2020-06-04 01:40 AM
GPIOA->MODER &= ~((U32) "pinX");
GPIOA->MODER|= ~(U32) "pinX");
I don't know what this means, give exactly the code you've used.
Haven't you changed a different pin than you've intended?
Observe VDD using oscilloscope. If there's a dip below 1.8V or whatever level is set to BOR, the problem is that setting that pin causes a surge in power consumption and you should check your hardware connections.
JW
2020-06-04 07:16 AM
@Community member thank you for Answer.
the Problem was some thing else in Electronic Design that I have overshadowed.