Need Help with VSCode Pymakr

  • I cannot seem to get a connection to a LoPy on an extension board through VScode. Or maybe I don't understand how it works?

    I have a Lopy on an expansion board plugged in to the Serial Port. I have also connected the LoPy Wifi to the host PC running Windows 10. I have tested the serial port on Putty to verify it works and have used Telnet to check the Wifi connection. I even ran Atom and it connected to the board OK.

    With VS code after installing Pymakr I reviewed the Global Settings file and it was good with the correct ip address. I saved the file. I go to All Commands Button and click connect. Nothing seems to happen. At the bottom left the Pycom Console entry is ticked which I think means its connected. I scroll thru the tabs that say Problems/Output/Debug Console/Terminal and none of them show any response.

    I have tried all of the different methods of connecting shown in the Documentation and they all give the same result.

    I was expecting the same thing I see on Atom (which by the way just connects seamlessly and gives a Repl prompt)

    What if anything am I missing or misunderstanding?

  • Ralph

    I was using VSC for an extended period earlier today. The board kept losing connection to my PC. I had to keep resetting and re connecting. Eventually my PC crashed (bluescreen) with an error of "Memory Issue" or similar with root cause being ftser2k.sys which I think is the FTDI driver. The program I was working on involved reading a BLE beacon if that's relevant.

    As this may be related to the issue I thought I would let you know.

    BTW I switched to ATOM and am not having the same issue (so far!)

  • @ledbelly2142 @TCB I tried this today and managed to reproduce the problem by removing the tx jumper. It only happened once and I couldn't reproduce it again, so I wasn't able to pinpoint the cause in the code yet.

    But it looks like the tx jumper might indeed be the issue, sometime causing a weird character to to be send to pymakr, that ends up being 'undefined'. Looking at the code, this could cause the error in two places. We'll write a small fix for it and do some more testing on monday.

    If anyone still gets this "Cannot read property 'length' of undefined" error, please check the tx jumper and try again.

  • @TCB I agree the jumpers are not confidence inspiring, but in this case I suggest this is a red herring, as I am almost exclusively communicating over wifi and I have replaced the jumpers anyway with properly fitting ones. In any case, I have never had an issue with PuTTY or even the Pymakr IDE which I still occasionally use. Also, I have a board which was sitting perfectly happily on my desk which responded to the Ctrl-C every time without error but on rebooting my PC this morning generates the error every time!

  • Interesting. it was working solidly for me. So given ledbelly2142's comments got the program running and I took off the Tx jumper while it was running (bad practice I know) and got the error. I did this a few times and sometimes I got the error and sometimes not.

    I would have to say I am a bit suspicious about the jumpers, and I concur that they are not that tight. I received my expansion board with the Tx jumper loose in the packet. My past experience with this sort of jumper is once you put them on they stay on.

    However IMHO the non repeat-ability of the problem with the Tx jumper off suggests it has something to do with it but perhaps they are not the root cause?

  • Check your jumper pins, I had an issue updating firmware when the jumpers fell off. They are not that tight. This may be totally psychosomatic and have nothing to do with how the expansion board is wired, but the TX and RTS jumpers needed to be firmly 'on' for me.

  • @Ralph I am using the same version as @TCB , but I am still getting the error if I try to stop the code running using Ctrl-C.

  • Hi Ralph

    VSC Version 1.14.2
    Shell 1.6.6
    Renderer 56-0.2924.87
    Node 7.4.0

  • @TCB Very strange that this ctrl-c problem solved itself. I haven't been able to reproduce the problem yet. In any case I don't think it has anything to do with Java, since it's build on nodejs. There is also no functional difference between the Run button and the 'All commands - run current file'.

    I'll try some different ways and windows installations to see if I get the error as well. One question: which vscode version are you using?

  • Ralph, Dredd

    This is strange but it now seems to be working. I was thinking it might have something to do with my Java JRE which appears to be out of date. So I did a test run with the same file. I have not updated the JRE.

    This time when the program runs the Run Button changes to STOP which works and does indeed stop the program. Also Ctrl C and Ctrl D work as well. Ctrl C responds with "Keyboard Interrupt"

    No idea if anything changed in the background. There were no Windows Updates overnight on my PC.

    I am thinking this might be me not understanding the system? Yesterday I just pressed RUN. Today I went to "All Commands - Run current file" Is there a difference? With this in mind I closed VSC and opened it again. No file showing. Opened the file and just pressed RUN and it works.

    Dredd. I am wondering if yours is working now?

  • @Ralph Hi, it is a red Error Box and the program running does not seem to be affected.

  • Ralph and Dredd

    I am getting the same error as Dredd.

    I have Windows 10 (64 bit). I installed node.js v6.11.1LTS and verified it was installed using the command line Node -v. OK so far.

    As soon started VSC it detected the board and connected. Ctrl D worked OK and the board did a soft reset. Ctrl C did not seem to do anything but I have the default Boot and installed so no program was actually running.

    I set up a test file that just increments to 10000 and prints out the increment number - saved the file and hit the Run button at the bottom of the screen. The program runs to completion and stops normally. If I hit Ctrl C or Ctrl D I get a red error flag at the top which says "Cannot read property 'length' of undefined" and nothing else happens the program just runs to completion.

  • @dredd Good to hear it works! The error you are getting after ctrl-c, does it pop-up at the top of the screen as an error (red) or as a warning (yellow)? And does the program stop completely after this error or does it continue working properly?

  • @Ralph However, there seems to be an issue with the Ctrl- commands- there doesn't seem to be an easy way of stopping running code on the board (if it's looping a print command, etc.) for instance if I try Ctrl-C, I get an Error "Cannot read property 'length' of undefined"

  • @Ralph Thanks Ralph, I have now installed node.js on a windows 10 machine and Windows 7 32bit and terminal now seems to work through VSCode. Thanks for the tip!

  • Hi @TCB and @dredd, thanks for reporting this, sorry you've had these issues. Seems like both of you have a problem to connect to the terminal (which is started in a different process than that of vsc). A possible explanation is that nodejs is not installed on your machines or not added to your path. If this is the case, please install it and add it to the path before trying again.

    If that works, you will indeed see a terminal under the Terminal tab that works exactly the same as you are used to on Atom

    Let me know if it works.

  • I have a similar issue with WiPy on an expansion board. I have tried with windows 7 both 32 and 64 bit versions and windows 10. As you say, Atom works fine and PuTTY, Filezilla, but VS code says it's connected but there is no terminal output. Also, I usually get ERROR "The terminal process terminated with exit code: 3221225477"

Log in to reply

Pycom on Twitter