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

    Can connect in REPL but not with main.py

    Scheduled Pinned Locked Moved WiPy 2&3
    17 Posts 2 Posters 41 Views 2 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.
    • S Offline
      SciWax @robert-hh
      last edited by

      @robert-hh Thank you for the advise and fast answer. I really appreciate it. What I really liked about Pycom and their boards was the SSL/TLS support, so I could use it to talk with TLS secured websites out of the box.

      So if I would get one ESP32-S3 board and use micropython, I could immediately send a post request to a https website using TLS for web security reasons? I do not need to add a ssl certificate to an ESP32-S3 board myself, right? It will just work out of the box like for the pycom boards?

      Kind regards

      robert-hhR 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @SciWax
        last edited by robert-hh

        @SciWax There was some discussion in the MicroPython site that for TLS you might have to add your own certificates. Should be in the documentation. Different to Pycom, MicroPython.org does not run any web services.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          SciWax @robert-hh
          last edited by

          @robert-hh Yeah, I've looked in the forums and tried many examples from here. Also this one. I have to check, if "sleeps" also help here in your example code. I'm using the pycom expansion board and connect it to my notebook. I also tried two different WiPys and behaviour was the same.

          1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @SciWax
            last edited by

            @SciWax About TLS: See https://docs.micropython.org/en/latest/library/ssl.html

            1 Reply Last reply Reply Quote 1
            • S Offline
              SciWax @robert-hh
              last edited by

              @robert-hh Thank you. Good to know. I can work around the issue I have with the WiPys, because I just use them as a board to easily send data to my server. I just connect them to my other microcontroller board.

              1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @SciWax
                last edited by robert-hh

                @SciWax That is still strange. What is the level of P12, the antenna selection pin? Did you change something with it? The default is MAN_ANT, which is the level you force P12 to be. See https://docs.pycom.io/firmwareapi/pycom/network/wlan/

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  SciWax @robert-hh
                  last edited by SciWax

                  @robert-hh No, I didn't touch the Pin. I was thinking about it too, but all the tutorials talk about how you only need to touch this Pin, if you want to use an external antenna. Should I pull P12 low just in case? I'm using the internal Antenna.

                  robert-hhR 2 Replies Last reply Reply Quote 0
                  • robert-hhR Offline
                    robert-hh @SciWax
                    last edited by

                    @SciWax You can either put it to a definitive state or use the antanna=WLAN.INT_ANT option in the WLAN constructor. You can as well call wlan.antenna() to see the actual value or call wlan.antenna(WLAN.INT_ANT) to set it to internal antenna.

                    S 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @SciWax
                      last edited by

                      @SciWax If I have WiFi problems it usually also helps to reboot the Access Point.

                      S 1 Reply Last reply Reply Quote 1
                      • S Offline
                        SciWax @robert-hh
                        last edited by SciWax

                        @robert-hh I've checked the value of the output of

                        wlan.antenna()
                        

                        It was 2 without touching it

                        with

                        wlan.antenna(wlan.INT_ANT)
                        

                        it becomes 0

                        >>> wlan.antenna()
                        0
                        

                        If I upload the code with setting the wlan.antenna to internal nothing changes really:

                        while not wlan.isconnected()
                        

                        The code only works every second time, when I reset the board. During the first time attempt, where I just power it (Connecting the expansion board with the usb port), it gets stuck in the while loop, second time when using the reset button the WiPy gets the Wifi connection immediately. When I continue using the reset button again, it is getting stuck again, using it again, it connects immediately. Hence every second time it works. It is a really weird behaviour.

                        I don't know, if not being aware of the board starting with wlan.antenna() being 2 did something funny with the hardware. Does 2 stand for selecting the external antenna? Maybe that broke the WiPy a little, because this behaviour is so strange. It can't be my code I think.

                        When I have access to my other expansion boards, I will try another one and a fresh WiPy with setting the wlan.antenna to internal. Then Ive checked everything on a hardware level.

                        robert-hhR 1 Reply Last reply Reply Quote 0
                        • S Offline
                          SciWax @robert-hh
                          last edited by

                          @robert-hh Unfortunately during my project, I have no access to the access point and can't reboot it.

                          1 Reply Last reply Reply Quote 0
                          • robert-hhR Offline
                            robert-hh @SciWax
                            last edited by

                            @SciWax said in Can connect in REPL but not with main.py:

                            Does 2 stand for selecting the external antenna?

                            2 stands for MAN_ANT: taking the value from P12 to select the antenna mode.

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              SciWax @robert-hh
                              last edited by

                              @robert-hh okay, makes sense regarding the documentation. thanks for the information

                              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