New USB CDC/ACM Serial Stack - USB power-only and turnkey support #171
Replies: 12 comments 6 replies
-
On Mon, Jan 20, 2025 at 2:21 PM serialcomms ***@***.***> wrote:
Hello again Travis,
Latest USB stack available here RC1
<https://github.com/Serialcomms/zeptoforth-usb-rc-staging/tree/main>
New for this release RC1
- Turnkey operation ( if used - sample provided )
- Support for USB power-only usage ( after 20 second delay )
I know you put a lot of work into this, but I would much prefer it if the
USB CDC console were connected to immediately if and only if EMIT , KEY ,
or FLUSH-CONSOLE were called, without any delays. Such a design allows the
WELCOME message to connect the USB CDC console automatically, but also
allow both an INIT routine and a TURNKEY routine that executes after the
USB CDC console is initialized to do USB CDC console I/O, and does not
prevent any operation without the USB CDC console on bootup. When I worked
last on this code I had implemented such a mechanism, and I think such a
mechanism should be restored.
Travis
… Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sure - the user experience is good with a fast connect time and a stable and performant USB stack. I don't claim to fully understand the zeptoforth internals or exactly what is required for power-only or turnkey operation though. Can I leave that build with you for a few days until you've had a chance to look at it again ? I'm happy to do more for zeptoforth as it should help me when I come to refresh my 'C' USB stack. |
Beta Was this translation helpful? Give feedback.
-
On Tue, Jan 21, 2025 at 11:52 AM serialcomms ***@***.***> wrote:
Sure - the user experience is good with a fast connect time and a stable
and performant USB stack.
I don't claim to fully understand the zeptoforth internals or exactly what
is required for power-only or turnkey operation though.
Can I leave that build with you for a few days until you've had a chance
to look at it again ?
I'm happy to do more for zeptoforth as it should help me when I come to
refresh my 'C' USB stack.
If you want me to revise the code to fit the needs of zeptoforth I would be
happy to do so.
Travis
|
Beta Was this translation helpful? Give feedback.
-
On Tue, Jan 21, 2025 at 12:50 PM serialcomms ***@***.***> wrote:
Yes - that would be great thanks !
I am working on your code right now. The biggest change I have made is that
much of USB initialization occurs the first time EMIT or KEY is called
rather than on boot itself, so that both INIT and TURNKEY routines are not
blocked at all if no USB CDC console is available or there is no USB in the
first place (e.g. the device is powered off a non-USB power supply).
Travis
… Message ID: <tabemann/zeptoforth/repo-discussions/171/comments/11906381@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
On Sun, Jan 26, 2025 at 12:52 PM Travis Bemann ***@***.***> wrote:
On Tue, Jan 21, 2025 at 12:50 PM serialcomms ***@***.***>
wrote:
> Yes - that would be great thanks !
>
I am working on your code right now. The biggest change I have made is
that much of USB initialization occurs the first time EMIT or KEY is called
rather than on boot itself, so that both INIT and TURNKEY routines are not
blocked at all if no USB CDC console is available or there is no USB in the
first place (e.g. the device is powered off a non-USB power supply).
I have revised your code to start up the USB CDC console when EMIT or KEY
is called and tested it by creating an INIT routine that lit up the LED on
my Pimoroni Pico Plus 2 as the last thing on initialization and then
plugged my board into a USB wall wart and the LED lit up. Look for a new
pull request with my changes in it.
Travis
… Message ID: <tabemann/zeptoforth/repo-discussions/171/comments/11906381@
> github.com>
>
|
Beta Was this translation helpful? Give feedback.
-
On Mon, Jan 27, 2025 at 9:52 AM serialcomms ***@***.***> wrote:
That's your PR done now thanks Travis.
I can see that watchdog gone in it - I was about to ask if that was a good
idea or not ...
I've had to re-do line state notification (my bug, not yours) as it wasn't
working quite as I had expected.
Should fix an intermittent clipping of the welcome message in Minicom.
RC3 <https://github.com/Serialcomms/zeptoforth-usb-rc-staging/tree/RC3>
Back to you for any further updates or comments ?
I removed the watchdog because the watchdog should be normally driven by
the multitasker and not by USB, unless the user wants to specifically
substitute the multitasker-driven watchdog updates with their own watchdog
updates; a USB failure should not trigger a reboot, whereas a multitasker
hang indicates that either the system has crashed or a task is running in a
CRITICAL state for longer than it should, possibly indefinitely.
Travis
|
Beta Was this translation helpful? Give feedback.
-
On Mon, Jan 27, 2025 at 6:07 PM Travis Bemann ***@***.***> wrote:
On Mon, Jan 27, 2025 at 9:52 AM serialcomms ***@***.***>
wrote:
> That's your PR done now thanks Travis.
>
> I can see that watchdog gone in it - I was about to ask if that was a
> good idea or not ...
>
> I've had to re-do line state notification (my bug, not yours) as it
> wasn't working quite as I had expected.
>
> Should fix an intermittent clipping of the welcome message in Minicom.
>
> RC3 <https://github.com/Serialcomms/zeptoforth-usb-rc-staging/tree/RC3>
>
> Back to you for any further updates or comments ?
>
I removed the watchdog because the watchdog should be normally driven by
the multitasker and not by USB, unless the user wants to specifically
substitute the multitasker-driven watchdog updates with their own watchdog
updates; a USB failure should not trigger a reboot, whereas a multitasker
hang indicates that either the system has crashed or a task is running in a
CRITICAL state for longer than it should, possibly indefinitely.
I have started a new pull request that includes a fix to a bug where
USB::USB-SPECIAL-ENABLED? was not being properly initialized on boot,
resulting in cases of control-C and control-T z not working.
Travis
|
Beta Was this translation helpful? Give feedback.
-
On Tue, Jan 28, 2025 at 8:28 AM serialcomms ***@***.***> wrote:
Thanks for explaining how watchdog should be used and your bug fix.
Minor tidy up of EP0 setup in RC4
<https://github.com/Serialcomms/zeptoforth-usb-rc-staging/tree/RC4> from
me, but don't think there's much more I can add to this for now.
I reckon it must be very nearly good to go now, unless you need to change
anything else ?
I'll also need to go back and take down the old repos shortly to save any
future confusion.
The only thing I would request at this point is putting a \ comment above
each word explaining what it does in short; while we may remember all this
now, I like having such things so that down the line we don't forget what
word FOO or word BAR specifically does (and I don't trust word names
themselves to be sufficiently descriptive myself, even if in the immediate
present they may seem sufficient).
Travis
|
Beta Was this translation helpful? Give feedback.
-
On Fri, Jan 31, 2025 at 11:12 AM serialcomms ***@***.***> wrote:
Travis - sure - I get that.
Updated version with comments and minor updates here RC5
<https://github.com/Serialcomms/zeptoforth-usb-rc-staging/tree/RC5>
Separately, I have converted my USB Joystick
<https://github.com/Serialcomms/Raspberry-Pico-SDK2-USB-Joystick> to
zeptoforth - uses same usb core modified for HID.
It may be of interest to anyone interested in sending button presses or
movement data to a host ?
Mostly works, but would need your help with a couple of small issues first.
Regards, S.C.
Thanks for the updates to the USB CDC driver. The new comments, even though
they are short, are helpful.
I do have a small request (you can say no) -- would you mind using your
real name in the copyright headers (and I would add it to both the LICENSE
word and the LICENSE file), so you can personally be credited? I understand
if you do not want to (I know some people do not like using their real name
on the Internet). It is just that I feel like you would not be sufficiently
credited if I simply put down 'Serialcomms' in the LICENSE word and the
LICENSE file.
Travis
|
Beta Was this translation helpful? Give feedback.
-
You’re welcome. I’m happy to be credited as just Serialcomms (GitHub) for exactly the reasons you suggested thanks. |
Beta Was this translation helpful? Give feedback.
-
On Sat, Feb 1, 2025 at 10:24 AM serialcomms ***@***.***> wrote:
You’re welcome.
I’m happy to be credited as just Serialcomms (GitHub) for exactly the
reasons you suggested thanks.
Is the code ready to be copied into the zeptoforth source tree in your
opinion? This is because I would like to make a release including your new
USB CDC driver soon (probably not this weekend but maybe next), but I want
to make sure it is fully ready before I do that (as if it is I may copy the
code over this weekend).
Travis
… Message ID: <tabemann/zeptoforth/repo-discussions/171/comments/12026964@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
On Sun, Feb 2, 2025 at 1:21 AM serialcomms ***@***.***> wrote:
Yes, it is.
I’ll watch out for your new release and be available for any usb-related
issues if found. Hope it all goes well for you !
I have added the code, with a bit of reformatting (I prefer code to fit in
80 columns myself), to the main zeptoforth tree, in the devel and master
branches. Note that I renamed the filenames, so as to reuse the existing
src/rp_common/forth/usb.fs filename and then make the other filenames
consistent with it.
Travis
… Message ID: <tabemann/zeptoforth/repo-discussions/171/comments/12030303@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Hello again Travis,
Latest USB stack available here RC1
New for this release RC1
Beta Was this translation helpful? Give feedback.
All reactions