tabemann / zeptocomjs

A web terminal for Forth
MIT License
8 stars 0 forks source link

USB Console Connect #2

Open twillis-prog opened 7 months ago

twillis-prog commented 7 months ago

I really like the usb console for development work, but have issues getting it started with local and web Zeptocom.js. I am using rp2040_big/zeptoforth_full_usb-1.5.1.uf2

After a Windows reboot or hardware reset, Zeptocom hangs on Connect. After the 5 second timeout, I then open the port in a terminal app like RealTerm, connects immediately. Close the port and return to Zeptocom, Connect is now successful. Some how RealTerm can open a pico usb serial on first try, but Zeptocom can't.

MacOS Sonoma has problems detecting and finding a pico cu . port. Device /dev/cu.usbserial-00001214 is not available. Once it appears in the Connect list ( sometimes, but not always), works well till a forth reboot or hardware reset.

tabemann commented 7 months ago

I personally use zeptocom.js under Chrome on Debian, and the only issues I have observed is that it takes a few seconds (or longer, with a freshly flashed Pico because it has to process the UF2 file and then erase unused space in flash) before Chrome will recognize the tty device for zeptoforth's USB CDC console, and that if I use certain terminal emulators with the tty device I need to use GNU Screen afterwards before Chrome will see it.

I could take a look at how the USB CDC device performs under Windows with Chrome, as I do have those installed, even though I barely ever use them. I'll see how it goes. However, I am not optimistic with my luck getting Windows to see my USB-serial dongle (it took forever before the virtual COM port for that appeared, and I do not expect to have better luck with the zeptoforth USB CDC console).

tabemann commented 7 months ago

I was able to reproduce the issue with zeptocom.js on Chrome under Windows, and the problem persisted even after I upgraded Chrome. Note though that I have a rather old version of Windows 10 on here (I very, very rarely actually boot into Windows). I did fix an issue I saw with Tera Term where it was taking a long time to connect to the USB CDC console, and would not print data until I manually set the baud rate. Do try it again, even though TBH I would not get my hopes up. If you have persistent issues with zeptocom.js under Chrome on Windows I would suggest using zeptocom.js under Chrome on Linux or using Tera Term. You can get the latest zeptoforth from https://github.com/tabemann/zeptoforth/releases/tag/v1.5.4.3.

twillis-prog commented 7 months ago
Thanks for you response. 1.5.4.3 shows the com port in Device Mgr (Win 10) but will not open for RealTerm or Zeptocom. Back to 1.5.1, works as before. I really like Zeptocom as I develop, but I have learned to frequently save the Edit window, as Chrome does not preserve its contents under all circumstances. If I can get an usb enumeration on the MacBook Air, it works very well for me. Using too many engineering apps to get off windows for now.  Impressive Forth.  Working through RP2040 peripherals, next on to interrupts.Thanks Again. Terry Willis  From: tabemannSent: Thursday, March 14, 2024 12:20 AMTo: tabemann/zeptocomjsCc: twillis-prog; AuthorSubject: Re: [tabemann/zeptocomjs] USB Console Connect (Issue #2) I was able to reproduce the issue with zeptocom.js on Chrome under Windows, and the problem persisted even after I upgraded Chrome. Note though that I have a rather old version of Windows 10 on here (I very, very rarely actually boot into Windows). I did fix an issue I saw with Tera Term where it was taking a long time to connect to the USB CDC console, and would not print data until I manually set the baud rate. Do try it again, even though TBH I would not get my hopes up. If you have persistent issues with zeptocom.js under Chrome on Windows I would suggest using zeptocom.js under Chrome on Linux or using Tera Term. You can get the latest zeptoforth from https://github.com/tabemann/zeptoforth/releases/tag/v1.5.4.3.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
tabemann commented 7 months ago

I got 1.5.4.3 working under Chrome on Windows, but there is a little gotcha. The first time you connect your Pico, first start up Chrome with it unconnected, start zeptocom.js, click on the 'Connect' button, and after the pane that says that no devices are connected appears, then physically connect your Pico, and afterwards select the virtual COM port that appears. (Note that with 1.5.4.3 I had no need for connecting with a different terminal program first, per my tests, where I rebooted Windows and only started Chrome and no other terminal programs afterwards.) After that point you should be good to go, and if you reboot your Pico, without physically disconnecting it, you should be able to reconnect it with 'Connect' without any problems per my tests. Note that this was with my latest tests per last night.

OTOH I had major problems getting Realterm to work, which felt buggy to me, unlike Tera Term, which worked great for me, so I would recommend using either zeptocom.js or Tera Term.

One thing is that there are a number of bugfixes and improvements in 1.5.4.3 relative to 1.5.1 so I would highly recommend you stick with 1.5.4.3 rather than revert to 1.5.1

Travis

twillis-prog commented 6 months ago
Tried 1.5.4.3 in Windows 10 Chrome Zeptocom. Connected perfectly on initial connect.  Regards,Terry Willis From: tabemannSent: Thursday, March 14, 2024 11:33 AMTo: tabemann/zeptocomjsCc: twillis-prog; AuthorSubject: Re: [tabemann/zeptocomjs] USB Console Connect (Issue #2) I got 1.5.4.3 working under Chrome on Windows, but there is a little gotcha. The first time you connect your Pico, first start up Chrome with it unconnected, start zeptocom.js, click on the 'Connect' button, and after the pane that says that no devices are connected appears, then physically connect your Pico, and afterwards select the virtual COM port that appears. (Note that with 1.5.4.3 I had no need for connecting with a different terminal program first, per my tests, where I rebooted Windows and only started Chrome and no other terminal programs afterwards.) After that point you should be good to go, and if you reboot your Pico, without physically disconnecting it, you should be able to reconnect it with 'Connect' without any problems per my tests. Note that this was with my latest tests per last night.OTOH I had major problems getting Realterm to work, which felt buggy to me, unlike Tera Term, which worked great for me, so I would recommend using either zeptocom.js or Tera Term.One thing is that there are a number of bugfixes and improvements in 1.5.4.3 relative to 1.5.1 so I would highly recommend you stick with 1.5.4.3 rather than revert to 1.5.1Travis—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
tabemann commented 6 months ago

Good to hear!

Travis

Message ID: @.***>

twillis-prog commented 6 months ago

A little more feedback:Tried 1.5.4.3 on macOS Somoma. The Pico now enumerates as a cu.usbmodem but does not open in Zeptocom. Tried App Store SerialTools, opens immediately, but keyboard input not working until DTR was activated. Then works as expected. Still no joy in Zeptocom - Connecting to port immediately closes connection window, but not connected. SerialTools will work, but I’m spoiled by Zeptocom.Regards,Terry WillisOn Mar 15, 2024, at 5:25 PM, tabemann @.***> wrote: Good to hear!

Travis

Message ID: @.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

tabemann commented 6 months ago

I am having trouble getting the Pico to enumerate under macOS, using a machine I borrowed. I should note that waiting until DTR is on purpose ─ there is an issue with Linux where the output of the USB CDC console is corrupted if it does not wait for DTR.

twillis-prog commented 6 months ago
Just a guess:Maybe the problem is DTR sequence. DTR needs to be asserted by the usb serial driver. If attempt to Connect occurs before DTR asserts, it may fail. I noticed in SerialTools that DTR had to be asserted before any console input was accepted.  ‘screen /dev/cu.usbserial-xxxxxxxx’  had no issues, but Zeptocom fails silently, no indication of why.Windows 10/Chrome is solid now, even see the initial message after reset/re-connect. Regards,Terry Willis From: tabemannSent: Friday, March 15, 2024 10:13 PMTo: tabemann/zeptocomjsCc: twillis-prog; AuthorSubject: Re: [tabemann/zeptocomjs] USB Console Connect (Issue #2) I am having trouble getting the Pico to enumerate under macOS, using a machine I borrowed. I should note that waiting until DTR is on purpose ─ there is an issue with Linux where the output of the USB CDC console is corrupted if it does not wait for DTR.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
tabemann commented 6 months ago

Previously there was a bug in the handling of USB setup (the board was not responding to certain USB setup packets) that was causing significant issues, particularly on Windows. This was fixed in 1.5.4.3. However, waiting for DTR is per design, because on Linux if DTR is not waited for the data transmitted over the USB CDC console will be corrupted.

twillis-prog commented 6 months ago
Looking at JS docs (I am not an syntax expert) something likeif termTab.port.getSignals(dataTerminalReady) is false then termTab.port.setSignals(dataTerminalReady=true)to override any default settings. From: tabemannSent: Friday, March 15, 2024 10:13 PMTo: tabemann/zeptocomjsCc: twillis-prog; AuthorSubject: Re: [tabemann/zeptocomjs] USB Console Connect (Issue #2) I am having trouble getting the Pico to enumerate under macOS, using a machine I borrowed. I should note that waiting until DTR is on purpose ─ there is an issue with Linux where the output of the USB CDC console is corrupted if it does not wait for DTR.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
tabemann commented 6 months ago

I added termTab.port.setSignals({ dataTerminalReady: true }) and it works just as well as it did before under Linux, but I do not know if it will solve your issues with zeptocom.js under macOS.

tabemann commented 6 months ago

After I configured the Mac running Ventura I borrowed to automatically allow devices under Privacy and Security (which had been proving a major issue for me, and for which I had a hard time finding an answer to the Interwebs), with my latest zeptocomjs I was able to use an RP2040 board without a problem. With SerialTools, though, it still required manually asserting DTR before it would work, but I think that is just a problem with that terminal, because I installed picocom with Homebrew and used that and had no such issue.

twillis-prog commented 6 months ago
My problem seems to be I updated (mistake) a working MacBook Air 2017 with Sonoma 14.4. Apple has changed the java script engine per https://www.bleepingcomputer.com/news/apple/oracle-warns-that-macos-144-update-breaks-java-on-apple-cpus/. Seems to do same on Intel.  On windows 10 Chrome things seem stable. With my newbie (sort of, I bought the xerox copy of the Kttt Peak Primer when it was published. Never had a platform to work with it). When I crash Zeptoforth doing hardware interface development, Attention doesn’t do anything. Sometimes I don’t get an ok after executing a work. Pressing >>> gives prompt. Not sure what causes this.  If I don’t get ok, reboot recovers and the initial message is printed upon Connect. Reboot works reliably.  A nice to have would be to automatically Connect to the previous port. Noticed that after a crash, hardware reset, attempting to open port RealTerm reports a semaphore error. Workaround is to delete the port in Device Manager or reboot Windows. Noticed when text copying from Terminal, ctlr-c does not work, but right-click does.I am not able to successfully Set Working Directory, maybe because its on Dropbox. Thanks for the Mac tips, I will update zeptocom and retry. Regards,Terry Willis   From: tabemannSent: Saturday, March 16, 2024 5:59 PMTo: tabemann/zeptocomjsCc: twillis-prog; AuthorSubject: Re: [tabemann/zeptocomjs] USB Console Connect (Issue #2) After I configured the Mac running Ventura I borrowed to automatically allow devices under Privacy and Security (which had been proving a major issue for me, and for which I had a hard time finding an answer to the Interwebs), with my latest zeptocomjs I was able to use an RP2040 board without a problem. With SerialTools, though, it still required manually asserting DTR before it would work, but I think that is just a problem with that terminal, because I installed picocom with Homebrew and used that and had no such issue.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
tabemann commented 6 months ago

On Thu, Mar 21, 2024 at 1:35 PM twillis-prog @.***> wrote:

My problem seems to be I updated (mistake) a working MacBook Air 2017 with Sonoma 14.4. Apple has changed the java script engine per https://www.bleepingcomputer.com/news/apple/oracle-warns-that-macos-144-update-breaks-java-on-apple-cpus/. Seems to do same on Intel. On windows 10 Chrome things seem stable. With my newbie (sort of, I bought the xerox copy of the Kttt Peak Primer when it was published. Never had a platform to work with it). When I crash Zeptoforth doing hardware interface development, Attention doesn’t do anything. Sometimes I don’t get an ok after executing a work. Pressing >>> gives prompt. Not sure what causes this. If I don’t get ok, reboot recovers and the initial message is printed upon Connect. Reboot works reliably. A nice to have would be to automatically Connect to the previous port. Noticed that after a crash, hardware reset, attempting to open port RealTerm reports a semaphore error. Workaround is to delete the port in Device Manager or reboot Windows. Noticed when text copying from Terminal, ctlr-c does not work, but right-click does.I am not able to successfully Set Working Directory, maybe because its on Dropbox. Thanks for the Mac tips, I will update zeptocom and retry. Regards,Terry Willis

I should note that that issue reported by Oracle affects Java, not JavaScript, which has little to do with Java aside from some very superficial syntax and the name.

I had problems with RealTerm myself. If you are not using zeptocom.js on Windows, I would otherwise suggest using Tera Term, which I have found works well.

About Attention (control-T outside of zeptocom.js) followed by 'z', that will save you if you've simply managed to put the main task into an infinite loop or like (which is what it is for, as it will usually allow you to get out of such states without losing your state), but if you actually crash the system generally Reboot (control-C outside of zeptocom.js) is generally needed, unless you manage to crash it really hard and then a power cycle may be needed.

About not getting an 'ok', that generally happens if you are executing something in another task and it outputs text after the 'ok' is printed -- or if you have managed to cause a hardware exception that got successfully recovered from, which an exception trace got printed to UART0 (note that this cannot be printed to the USB CDC console because this occurs within the exception handler, and the USB console cannot be printed to within exception handlers), causing a seemingly silent failure only indicated by a missing 'ok'. For this reason when developing I often like to keep a USB-serial dongle hooked up to UART0 with picocom running even if I am using the USB CDC console to catch exception traces. Note that clicking '>>>' without any text in the input line simply sends a CR to zeptoforth, which is treated as an empty line of code, hence the 'ok' afterwards.

About not automatically connecting to the previous port, that is actually done by Tera Term, but I have not implemented it for zeptocom.js (I should check if that is even possible with it).

About control-C not working for copying from the terminal in zeptocom.js, that is due to xterm.js, which is used by zeptocom.js, not treating control-C as a copy operation.

Thanks for the feedback,

Travis

Message ID: @.***>

tabemann commented 6 months ago

I checked and I could not get auto-reconnection to work with zeptocom.js running under Chrome on Linux systems because each time the USB CDC device reconnects it is seen as a separate device, defeating any attempts to remember the device that had been connected before.

Travis

twillis-prog commented 5 months ago

Quick update on latest Mac Sonoma 14.14.1Made sure Chome had access rights to files.Executed in the terminal :“rsync zeptoforth_full_usb-1.5.4.uf2 /Volumes/RPI-RP2/“Copy completes without errorReset PicoEnumerates as cu.usbmodem1401Connects and works in Zeptocom.jsNow Zeptocom works same as WindowsThanks for your helpRegardsTerry WillisOn Mar 21, 2024, at 9:28 PM, tabemann @.***> wrote: I checked and I could not get auto-reconnection to work with zeptocom.js running under Chrome on Linux systems because each time the USB CDC device reconnects it is seen as a separate device, defeating any attempts to remember the device that had been connected before. Travis

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>