I need help in talking to a USB peripheral from SwiftForth. I have not found an adequate amount of information anywhere.
Briefly, I am designing a circuit on a small board that generates a few simple pulses, under the control of a PC app that sends three bytes to it over the USB. The circuit is one chip, the Silicon Labs C8051F320, which has exactly what I want: price, functionality, complete USB hardware on-chip, SwiftX support.
Software required: host PC app that puts up a GUI dialog and talks to the target board USB; target app that acts as a USB device and generates a few very simple pulses. The main apps on both the PC and target are easy and I have used SwiftForth and SwiftX for years. But dealing with USB is a very big problem.
The actual USB communication required is trivial: transmit three bytes. I found out after much investigation that, bottom line, the least complex USB modality for such a purpose is the "human interface device" class in which "reports" of "vendor-defined" bytes are transmitted.
When the SwiftX software and C8051F320DK board were purchased, Forth Inc. sent me source for a working application: a SCSI flash drive controller. I will have to adapt the USB port handlers to the HID class, which in principle I think I can do.
In the PC host app (having passed on generic driver-writing components like WinUSB) I will have to call the existing HID class drivers which are nowadays included with Windows. I would need to get a handle to the peripheral device, to define and send reports, and do other necessary things.
Not only can I find no examples in Forth of USB access, I can not even find examples in C! I am good at following Petzold's C-based tutorials and making the appropriate API calls from SwiftForth. But all the examples in Axelson's USB Complete are in Visual Basic and C#, and the same goes for the Maxim and Silicon Labs. How do I translate from C# to SwiftForth? I have searched Google for hours and found no C examples there either.
Once I have all the descriptors and API calls worked out for sending a few bytes of generic ("vendor defined") data to a device, and an implementation in SwiftForth, USB will no longer be a Berlin Wall obstacle to Forth programmers. But is this feasible?
Alan Furman
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Wed Oct 21 2009 - 15:28:38 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.