Page 3 of 6

Re: main.py does not appear to working after boot

Posted: Sun Jul 14, 2019 8:59 pm
by smith.randallscott
I created the main.py on the raspberryPI, then transferred it to the esp32 by being already logged into the ESP32, then using the command "cp main.py /pyboard/" each time that I modify main.py I use the same procedure. I edit the file on the Pi and then transfer it to the ESP32 using the cp command.

I am using rshell for the repl.

Thanks for all your help

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 1:10 pm
by smith.randallscott
Any thoughts?

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 1:23 pm
by kevinkk525
You didn't ask any question so what should we say about it? It's a valid method to update your main.py...

Edit: Ah right, the question is in your title only. Please show the main.py, has it ever worked?

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 2:22 pm
by smith.randallscott
Main only executes when I am already logged into the REPL and issue machine.reset() or cmd+D or soft reset. When I do that all works fine. If I power cycle the unit main.py does not execute. I don't know how to further troubleshoot this. Any help would be appreciated.

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 2:33 pm
by Roberthh
What happens if you power the device with a simple USB Micro power supply, like a smart phone charger? I expect it to work, because that's what I do sometimes.

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 2:36 pm
by Roberthh
It is a little bit strange because that is the code in question:

Code: Select all

    // run boot-up scripts
    pyexec_frozen_module("_boot.py");
    pyexec_file_if_exists("boot.py");
    if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
        pyexec_file_if_exists("main.py");
    }
So there a two reasons why main.py is not executed:
1. It does not exist
2. The device is not in the mode PYEXEC_MODE_FRIENDLY_REPL. That may be cause by a Ctrl-A character sent to the device by the RPi during startup, for whatever reason.

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 3:15 pm
by smith.randallscott
How do I get similar with what that code actually means, especially the frozen part? Also main.py is in the root of the file system has far as I can tell.
>>> os.listdir('')
['boot.py', 'main.py']
>>>

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 3:47 pm
by Roberthh
The file _boot.py is embedded in the firmware. That's why it is called frozen. If you build your own firmware, you can also embed python scripts into the firmware, at the benefit of faster loading and lower RAM usage.
Did you make the test with a simple USB power supply?

Re: main.py does not appear to working after boot

Posted: Tue Jul 16, 2019 4:03 pm
by smith.randallscott
No it will be several hours before I can make this test. Thank you for all your help.

Re: main.py does not appear to working after boot

Posted: Wed Jul 17, 2019 12:30 am
by smith.randallscott
Using a standard power supply (not powering from the Raspberrry Pi) produces the same results, main.py is not executing. Is there another way of troubleshooting this problem? Is there any chance there's something wrong with the ESP32? Beyond setting variables, energizing leds, and print statements, I'm at a loss as the how to trouble shoot it further. Any and all help will be appreciated