2018-12-03 11:39 AM
Hello,
I'm working on a custom board, using STM32L072 (Murata LoRa module), and it does not seem to boot when powered up, unless I trigger a manual reset.
The board is powerd via USB (with a 3.3V LDO), and the supply reach 3.3V within 370µs.
The reset is only wired to the debugger connector and to an unpopulated 0402 footprint. BOOT0 is wired directly to ground (using a 0 Ohm resistor). I tried to enable BOR, without success.
When I use the debugger, everything works fine (it does trigger the reset), however without debugger, nothing happens on power up. If I use a wire to short GND and RESET, the program is started as soon as I remove the wire.
When I monitor the reset pin, the rising edge occurs when my VDD voltage is only 1.08V. Does it show when the MCU actualy start ?
One GPIO is wired to USB 5V, trough a voltage divider. The rising edge on this pin is at the same time as the reset signal. Could this be the cause of this issue ?
Any advices to solve this ?
Regards.
2018-12-03 12:15 PM
You should solder some 100 nf capacitor to the unpopulated 0402. Without capacitor, nReset will behave unexpected.
2018-12-03 01:32 PM
I think datasheet say it is required only if reset if noisy (or to avoid PB bounces).
I did try anyway, but there is no changes. I used a trough hole ceramic capacitor with a small wire as I don't have 0402 here. I will try again with 0402 later this week but I guess it will be the same result.
Is it possible my 5V detection trigger the BOD reset before the power supply is stable ?
2018-12-04 01:27 AM
Hi,
I tried to connect a capacitor between RST and GND and another one on my voltage divider to slow down the signals.
I checked both signals, and they are much slower than my 3.3V now.
I can confirm reset is not the issue, sorry for the wrong topic.
I tried to load a simple LED blinking program, which is working. It seems at some point, my program gets stuck, but only at power up. On the next reset, it works properly. Might be hard to find whats wrong, as I can't use the debugger...
2018-12-04 04:05 AM
Use as serial port to output diagnostic or checkpoint information. Have the HardFault_Handler output info if it gets there along with Error_Handler and any other infinite loops.
2018-12-04 04:27 AM
I finally manage to find the issue.
I use USB CDC to communicate with the host. To ensure CDC is ready before writing any data, I did this :
void USB_puts(const char * str){
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) hUsbDeviceFS.pClassData;
while(hcdc->TxState != 0);
CDC_Transmit_FS((uint8_t*)str, strlen(str));
}
During init, an interrupt (EXTI) was triggered, before USB initialization. This interrupt was trying to use CDC, and was stuck in the while loop.
I added a timeout, and I also check if the USB CDC is initialized. Problem solved.
I will also add some code to bypass the timeout if the function is called from ISR (in which case, the function will exit if CDC is busy).
Thanks for trying to help anyway.