Hi everyone, I've a issue with autostart my script. I've write and load my `main.py` script that toggle a led every second and put him in the flash. Using ampy I've verified the script is correctly loaded. When I power-on my board the 'main.py` doesn't run, it start only after a soft reboot (ctrl+D). The same issue there is if I put my code in the 'boot.py' file. Any suggestion? Thanks for your support!
@edit: I test the same code on a ESP32 and all works fine, every power on/off cycle the code start without problem.
[NUCLEO-L476RG] main.py start only after soft-reboot
Re: [NUCLEO-L476RG] main.py start only after soft-reboot
I've done some tests. I'm using a custom board mounting a STM32-L476RG microcontroller, and I can't fix this problem. Using an official NUCLEO-L476RG instead, the main.py start autonomously when the board is powered and works normally. It's possible that the problem have to be found in hardware connection? Thanks to evreyone can help me to investigate where is the problem.
Re: [NUCLEO-L476RG] main.py start only after soft-reboot
I found the problem, then the solution. The problem was in the hardware and configuration of my custom board, it have not a user switch like pyBoard or NUCLEO-L476RG, but in `mpconfigboard.h` was present:
On this pin my board forces the 0, so the system was starting in Safe Mode (https://micropython-docs-esp32.readthed ... reset.html), so `boot.py` and `main.py` was skipped. Changing the user button pin, all normally works.
Code: Select all
#define MICROPY_HW_USRSW_PIN (pin_C12)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)