Hi Tristan,
If you really want to solve your dilemma with USB on CH32V203 you could go
through the painful process of using MounStudio's use of DGB and stepping
through one instruction at a time (at USB code breakpoints) and examining
the registers but you will be at the mercy of programmer's code (what he
was doing - unless he has provided sufficient detail in his commenting of
the code). The other problem is understanding the USB specification (what
is supposed to be done) and what is happening in the code, it could also
involve DMA, you could easily get bogged down and frustrated at this
process. One thing I have learned as a software developer over the years is
to spot trouble and find an alternate path around it, you just don't have
the time to solve the problem and that is why there is a lot of broken
software floating around (GitHub is full of this stuff).  From what I can
see the founder of AmForth tried to provide a quality version of forth
which could possibly be compatible with other forths (there are many of
them).
The other thing you can do is search the internet (get ChatGPT and Copilot to
help) with a similar problem on CH32V203 I am am sure others have run into
the same issue but it is a lot easier than trying to debug this problem
yourself.

Have good Holiday
John S.



On Tue, Dec 23, 2025 at 2:08 PM John Sarabacha <[email protected]> wrote:

> Hi Tristan,
> USB is not being used for the CH32X033 application since it is not needed.
> Any knowledge gained here (on CH32X033 USB) may not solve your problem.
> Looking at the system block diagrams of both chips shows the USB peripheral
> configuration is different (e.g are on different buses operating at
> different clock speeds). Wish I could help.
> Regards
>
> On Tue, Dec 23, 2025 at 12:45 PM Tristan Williams <[email protected]> wrote:
>
>> Hello John,
>>
>> If in your experimenting with the CH32X035 you manage to get an interrupt
>> driven USBD or USBFS interface enumerating (or better) I would love to know
>> how. It is the remaining piece in getting a more useful AmForth on the
>> CH32V203.
>>
>> Best wishes,
>> Tristan
>>
>>
>> > On 22 Dec 2025, at 17:27, John Sarabacha <[email protected]> wrote:
>> >
>> > Hi All,
>> > For those interested it looks like amforth (RISCV) combined  with C and
>> > inline assembly routines will at least build for CH32X033/035 using
>> > MounRiver Studio  2.3.0. This combination is being tested for an
>> existing
>> > application that embeds amforth (RISCV) for use as a VM (virtual
>> machine).
>> > Note: at this point although the previous application (C and inline
>> > assembly) was well tested and known to work, the addition of  amforth
>> > (RISCV) is still untested so it is experimental.
>> > MounRiver Studio  2.3.0 is being used to deploy and debug the
>> application.
>> > Putty is used for the serial I/O through WCH-LinkE-1v3
>> >
>> > C and inline assembly routines only
>> >   text   data    bss    dec    hex filename
>> > 17092    160   4220  21472   53e0 GLANN_033-251205x.elf
>> >
>> > with  amforth (RISCV)
>> >   text   data    bss    dec    hex filename
>> > 34340    160   3452  37952   9440 GLANN_033-251222x.elf
>> >
>> > amForth still lives on
>> > Regards to all
>> >
>> >> On Sat, Dec 20, 2025 at 2:25 AM <[email protected]> wrote:
>> >>
>> >>> On 2025-12-19 20:15, John Sarabacha wrote:
>> >>> Is the latest release for amForth a good starting point to make
>> changes
>> >>> and
>> >>> use for CH32X033/035 chips particularly for calling existing C and
>> >>> assembly
>> >>> routines? Even though existing work is on going  with CH32V307
>> >>> (amForth-RV), this information is invaluable for a working version for
>> >>> CH32X033/035 even though flash and ram is less (62k flash 20k sram)
>> >>> compared to CH32V307. There is  a version of forth on ch32v003 on
>> >>> GitHub,
>> >>> however my research has shown that amForth should be a better fit for
>> >>> hybrid deployment, using forth to manage code on remote
>> >>> microcontrollers.
>> >>> Any comments would be appreciated.
>> >>>
>> >>> Regards,
>> >>> John S
>> >>>
>> >>> _______________________________________________
>> >>> Amforth-devel mailing list for http://amforth.sf.net/
>> >>> [email protected]
>> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>> >>
>> >> Hello John,
>> >>
>> >> AmForth-RV is experimental, and the latest efforts, mine at least,
>> >> have not made it to the svn repo. As the new maintainer-lite (see
>> >> mailing list archive) for AmForth, this is something I am working
>> >> towards.
>> >>
>> >> On the CH32V307, AmForth-RV is able to call C and external assembly
>> >> routines, and additionally handle C and Forth based isr. This is how
>> >> it uses the WCH library to provide access to the CH32V307 USBHS
>> >> peripheral. Some flash usage data.
>> >>
>> >> C build with USB (AmForth-RV assembly core + external C from WCH)
>> >>
>> >>    text           data     bss     dec     hex filename
>> >>   43492            541   15204   59237    e765 ./build/amforth.elf
>> >>
>> >> ASM build (AmForth-RV assembly core only)
>> >>
>> >>    text           data     bss     dec     hex filename
>> >>   35544            297   12848   48689    be31 ./build/amforth.elf
>> >>
>> >> Looking at the ASM build, it needs ~36kB of flash. With the removal of
>> >> surplus development/debug material perhaps, 32k flash. I have this
>> >> running on a CH32V203 which is 64kB/20kB. The C build with USB does
>> >> not really fit, and I have not managed to get the USBFS device on
>> >> my particular CH32V203 dev board to work yet.
>> >>
>> >> AmForth-RV *really* is experimental, so if you want to experiment with
>> >> the CH32X033/035 mcu it might be a good place to start. AmForth-RV in
>> >> 64kB/20kB with USB would be a very nice milestone.
>> >>
>> >> Best wishes,
>> >> Tristan
>> >>
>> >>
>> >> _______________________________________________
>> >> Amforth-devel mailing list for http://amforth.sf.net/
>> >> [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>> >>
>> >
>> > _______________________________________________
>> > Amforth-devel mailing list for http://amforth.sf.net/
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>
>>
>> _______________________________________________
>> Amforth-devel mailing list for http://amforth.sf.net/
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>
>

_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to