My IDE configuration using Notepad++, ampy and Tera Term

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
aivarannamaa
Posts: 31
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by aivarannamaa » Sun Mar 01, 2020 2:53 pm

stanely wrote:
Sun Mar 01, 2020 2:18 pm
This is probably off topic from this thread, but are you using flow control when communicating to MicroPython targets? I'm using Ampy and esptool at crazy fast baud rates without any issues, ever. I can't imagine all of that would work reliably without use of CTS/RTS flow control.
I assumed I can't use CTS/RTS if MicroPython also supports it. How did you use it? I don't see any reference to CTS/RTS in Ampy code: https://github.com/scientifichackers/am ... rd.py#L133

stanely
Posts: 40
Joined: Fri Jan 17, 2020 5:19 am
Location: Ohio, USA

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by stanely » Sun Mar 01, 2020 5:06 pm

aivarannamaa wrote:
Sun Mar 01, 2020 2:53 pm
stanely wrote:
Sun Mar 01, 2020 2:18 pm
This is probably off topic from this thread, but are you using flow control when communicating to MicroPython targets? I'm using Ampy and esptool at crazy fast baud rates without any issues, ever. I can't imagine all of that would work reliably without use of CTS/RTS flow control.
I assumed I can't use CTS/RTS if MicroPython also supports it. How did you use it? I don't see any reference to CTS/RTS in Ampy code: https://github.com/scientifichackers/am ... rd.py#L133
You're right, I see no mention of flow control. I don't know. Does this happen mostly when you're receiving or sending data?

User avatar
aivarannamaa
Posts: 31
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by aivarannamaa » Mon Mar 02, 2020 5:53 pm

stanely wrote:
Sun Mar 01, 2020 5:06 pm
Does this happen mostly when you're receiving or sending data?
I don't know, it is not clear from the reports.

pmulvey
Posts: 32
Joined: Sun Jul 29, 2018 8:12 am
Location: Athlone, Ireland

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by pmulvey » Tue Mar 24, 2020 9:44 pm

I get bouts of ampy complaining that it cannot enter raw REPL on the ESP8266. I say bouts because sometimes it's fine but after a while it starts to act up. I tried out the ESP32 and the problem became almost constant. I delved into the ampy module "pyboard.py" and noticed that the code made just one attempt at entering raw REPL with a 2 CTRL-C's followed by a CTRL-A. I changed the code to do multiple retries.
The original looks like this starting at line 184:

Code: Select all

        while n > 0:
            self.serial.read(n)
            n = self.serial.inWaiting()


        self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL
        data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>')

        if not data.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
            print(data)
            raise PyboardError('could not enter raw repl')
Made the following change:

Code: Select all

        while n > 0:
            self.serial.read(n)
            n = self.serial.inWaiting()

        for retries in range(0, 8):
            self.serial.write(b'\r\x03\x03')
            time.sleep(.1)
            self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL
            data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>', .2)
            if data.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
                break
            print (retries)
        
        if not data.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
            print(data)
            raise PyboardError('could not enter raw repl')
Ampy now gets the raw REPL everytime on the ESP32, will have to monitor its performance with ESP8266 over a period of time because as I said it was working a lot of the time.
Paul Mulvey

User avatar
dhylands
Posts: 3295
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by dhylands » Tue Mar 24, 2020 11:36 pm

Yeah - I had to make a similar change to rshell to get it working more reliably on ESP8266 and ESP32.

rshell sends a Control-C every 100 milliseconds until it gets a >>> before continuing with pyboard.py.

The reason is that the boards can take a while before micropython starts up, and with some boards, opening the serial port causes the board to reset, and the startup delay then pushes the micrpython start beyond where pyboard.py expects the Control-C's to work.

schillerx
Posts: 1
Joined: Wed Mar 25, 2020 10:57 am

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by schillerx » Thu Mar 26, 2020 5:08 am

Hello,

I'm using Thonny and are happy most of the time, especially because I haven't found so much alternative IDEs. Thank you for your work on this!!!

One question: is there a way to get auto completion?

Sometimes the serial connection to the boards and the access to the filesystems seems to be buggy.

For example:

- when I open files directly on the device the below window of thonnys shows all files and the connection is broken.
- I have to reconnect the cable and press the start/stop button

--> I can prevent this by doing the following after connect the device with Thonny:
- in the repl console:
-> import os
-> os.listdir()

Sounds crazy I know but works for me... :)

Im using TTGO boards with Wrover and Wroom Chips of ESP32 (TTGO T-Energy T18 / ESP-WROOM-32 ESP-32s). It is everytime the same experiences. I also tried to update my windows 10 drivers but without success.

If you are interested I can try to help you to find and debug this issues...


Greetings!

User avatar
aivarannamaa
Posts: 31
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: My IDE configuration using Notepad++, ampy and Tera Term

Post by aivarannamaa » Thu Mar 26, 2020 6:21 am

schillerx wrote:
Thu Mar 26, 2020 5:08 am
If you are interested I can try to help you to find and debug this issues...
Sure! Please copy your issue and workaround to https://github.com/thonny/thonny/issues

I have started refactoring the MicroPython part of Thonny. Hopefully next version will be more reliable.

Code completion can be invoked with Ctrl+Space, but at the moment you can't have it automatically (https://github.com/thonny/thonny/issues/625)

Post Reply