Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    lopy not running main.py

    Scheduled Pinned Locked Moved LoPy
    lopyboot.pyrepl
    19 Posts 6 Posters 7.0k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      gouao
      last edited by

      Hello,

      I re-open a post I started here https://forum.pycom.io/topic/511/run-script-on-boot-for-lopy .

      Let me explain you my issue :

      • i have a lopy with only the recommended code in boot.py (for serial connections), and my script in the main.py
      • when power plugged, it doesn't run main.py but arrives on REPL (so it stops in boot.py if i'm right ? )

      It may be a step I passed.. any help will be appreciated!
      Furthermore, do you know what the sync button in pymakr does ?

      J L 李 3 Replies Last reply Reply Quote 0
      • J Offline
        jmarcelino @gouao
        last edited by jmarcelino

        @gouao
        Have you tried connecting over FTP and checking if main.py is really there and has the contents you expect?
        If so can you post your boot.py file? You mentioned you made some changes to have the serial console.

        1 Reply Last reply Reply Quote 0
        • G Offline
          gouao
          last edited by

          Thanks for your fast reply!
          I will try FTP client.
          I refered on this page and entered this code below https://docs.pycom.io/pycom_esp32/pycom_esp32/getstarted.html

          from machine import UART
          import os
          uart = UART(0, 115200)
          os.dupterm(uart)

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            mmarkvoort @gouao
            last edited by

            @gouao

            I have the same thing as you.
            But when I hit the reset button on the LoPy, it will reboot and run the main.py.
            But when I plug the power in, it doesn't seem to run the main.py.
            Maybe it is running, but can't we see it in pymakr.

            G 1 Reply Last reply Reply Quote 0
            • L Offline
              livius @gouao
              last edited by

              @gouao
              how do you realize that main.py is not running?
              What do you expected to see? Some output on repl? Some led, LCD?

              What do you see on repl output?
              Maybe you have some error in main.py and it is on the REPL output?
              And what do you use to see REPL? If Pymakr i recomend you to do not use it at all.

              think about people first, then computers

              1 Reply Last reply Reply Quote 0
              • G Offline
                gouao @mmarkvoort
                last edited by gouao

                @mmarkvoort
                Actually @jmarcelino was right and checking the lopy's folders helped me : the main.py file had some issues i fixed so now it can run the scripts after reboot and on power plug. Do you have the 3 ">>>" in Pymakr or you get only "Connected" ?
                I suggest you to check this too thanks to a FTP connection, and tell us if your issue persists!

                @livius
                I realized I wasnt in the main.py because I expected some output and LED response.
                Shouldnt I use Pymakr ? I already had some issues with it but what do you recommend me to do ?

                On a second hand I have a problem with the REPL with for example Putty or Screen, so I need the help of the Linux users please :)
                An error occurs :
                Unable to open connection to :
                Unable to open serial port

                After many searchs I guessed it's an authorization issue, and I already tried some things :

                • execute putty as super-user : "gksudo putty"
                • the user is already in the dialout group, and still not working except with the command before
                • chmod 777 /dev/ttyUSBx on each boot

                On the REPL i dont have the output i expect, instead of a sentence i have a character. It may be a speed problem, isnt it 115200 as I wrote on boot.py ?

                Do you know how can I give all permissions to my ttyusb ports in order to avoid all authorization issues in the future wich is active on boot ?

                Thank you all.

                M 1 Reply Last reply Reply Quote 0
                • M Offline
                  mmarkvoort @gouao
                  last edited by

                  @gouao

                  I have checked it with a simple flash to green in the main.py.
                  That is working on reset and on power plug.
                  In my other program it is only printing to console. So like I said earlier, it seems that it wont show it in pymakr when power plug. But it was a nice confirmation it does boot on power plug!

                  I have also had some trouble with pymark and curious about what other options there are.

                  G 1 Reply Last reply Reply Quote 0
                  • G Offline
                    gouao @mmarkvoort
                    last edited by

                    @mmarkvoort

                    Well, pymakr is perma failing to establish a connection with the board, I don't know if you had that error too ?
                    I can't even see my output e.g. putty screen (issue I explained below) and now pymakr.

                    M 1 Reply Last reply Reply Quote 0
                    • M Offline
                      mmarkvoort @gouao
                      last edited by

                      @gouao

                      I can connect through pymakr, but after power plug I have to click in console to reconnect.
                      On my windows it also didn't work at first. I had to install a driver for USB serial converter by hand, mine called FTDI. After that i could use it in pymakr.

                      Are you able to update the firmare?

                      G 1 Reply Last reply Reply Quote 0
                      • G Offline
                        gouao @mmarkvoort
                        last edited by

                        @mmarkvoort
                        i had the same issue, so i flashed the lopy , and it went well. Do you know the procedure ?

                        Did you try this on linux ? I had to install FTDI driver too but seems that it isn't enough.. That's why I can't even update de firmware, because of an error : Something failed trying to connect to the device.
                        I guess it's because of what I explained bellow on the authorization issues.

                        M 1 Reply Last reply Reply Quote 0
                        • M Offline
                          mmarkvoort @gouao
                          last edited by mmarkvoort

                          @gouao
                          I didn't try this on linux.

                          Here they say there are two types of FTDI drivers. VCP and D2XX. I can't remember which one I used. But the first one I tried said it installed the missing driver, but when I wanted to connect to the LoPy it didn't work. After research I deleted the driver and tried the other. After that I was able to connect to the LoPy.

                          It was very confusing because the driver said it was installed correctly.

                          G 1 Reply Last reply Reply Quote 0
                          • G Offline
                            gouao @mmarkvoort
                            last edited by

                            @mmarkvoort
                            For now it's ok for me concerning the FTDI drivers, but I agree it's a bit confusing in the first place.

                            Now I can connect on it e.g. REPL, I am curious about what other options @livius is talking about, because I actually encounter some connection issues with pymakr.

                            L 1 Reply Last reply Reply Quote 0
                            • L Offline
                              livius @gouao
                              last edited by livius

                              @gouao
                              I use this setup:

                              1. filezilla to modify files and write it back + Notepad++(to nicely edit files)
                              2. Arduino IDE-and from it COM port monitor to see repl and send command back by repl
                                I use Windows OS but it is avaiable on linux also
                                After install you must only set COM number and baud rate - and if you need not only read data by repl but also send commands - change line break termination - and it work like a charm :)

                              think about people first, then computers

                              G 1 Reply Last reply Reply Quote 1
                              • G Offline
                                gouao @livius
                                last edited by

                                @livius

                                1. For filezilla, are you perma connected on the lopy-wlan or you have some software settings in order to modify and transfer files while the lopy connected in serial, without establish a connection on the wlan ?
                                2. True it works well :)
                                L 1 Reply Last reply Reply Quote 0
                                • L Offline
                                  livius @gouao
                                  last edited by livius

                                  @gouao
                                  I have connected filezilla permanently to Wipy and do modifications and send it back.
                                  But i do modifications on files on computer and do not use option to edit file on board "directly"
                                  I modify on left panel not on the right panel ;-)

                                  think about people first, then computers

                                  G 1 Reply Last reply Reply Quote 1
                                  • G Offline
                                    gouao @livius
                                    last edited by

                                    @livius
                                    This is not what I meant, but while you are doing it, are you connected to the "wipy-wlan" network ?

                                    L 1 Reply Last reply Reply Quote 0
                                    • L Offline
                                      livius @gouao
                                      last edited by livius

                                      @gouao
                                      yes i connet to Wipy AP (wipy-wlan)

                                      and one hint
                                      to simplify developing process and speed it up
                                      i put always in the while true loop check if some button is pressed and break this loop
                                      this elimiminate need to restart board and reconnect to it :)

                                      Of course if you do not need to change from AP to STA mode

                                      think about people first, then computers

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        johnmcdnz
                                        last edited by

                                        I'm having a similar issue now.
                                        main.py will run after CTRL-D or machine.reset(). But, power cycling the Lopy (on expansion board) will connect REPL to pymakr, but main does not seem to run.
                                        I've done an os flash, and rewritten all the files. Problem continues though.

                                        I'm wondering if it is going to safe boot, factory mode as here:
                                        https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#boot-modes-and-safe-boot
                                        How can I can tell which mode is used?

                                        I've reset the expansion board jumpers and tightened them up as best I can. Could these be the problem?

                                        1 Reply Last reply Reply Quote 0
                                        • 李 Offline
                                          李鴻志 @gouao
                                          last edited by

                                          @gouao Have you deleted the first line? The first line cannot be deleted.
                                          # main.py -- put your code here!

                                          1 Reply Last reply Reply Quote 0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          • 1 / 1
                                          • First post
                                            Last post

                                          Pycom on Twitter

                                          Pycom