Shop OBEX P1 Docs P2 Docs Learn Events
USB serial — Parallax Forums

USB serial

msrobotsmsrobots Posts: 3,704
edited 2020-02-22 10:32 in Propeller 2
So I know that @garryj has Kbd and Mouse working, and it does flawless with my setup here.

That is HID protocol. I also read that mass-storage seems to work, but can't find any reference somehow.

What I really would like is serial usb, no need for FTDI, soft serial USB.

just dreaming,

Mike

Comments

  • cgraceycgracey Posts: 14,133
    That would be awesome! I wonder if it's possible to do without using some company's proprietary driver on the OS side. Has serial communication via USB become generic to Windows?
  • STM has been doing it for years now. I have a butterfly board with USB and no FTDI chip. I can even reconfigure it to emulate a mass storage device and serial at the same time.

    Mike
  • cgraceycgracey Posts: 14,133
    iseries wrote: »
    STM has been doing it for years now. I have a butterfly board with USB and no FTDI chip. I can even reconfigure it to emulate a mass storage device and serial at the same time.

    Mike

    Well, we should be able to do it, too, then.
  • On STM if you brick your chip which means you over wrote the startup code that emulates the USB device you can hold down a pin and reboot the device to put it in Boot Loader mode which emulates a serial DFU device. From there you can restore your program code.

    The P2 doesn't have that option.

    Mike
  • On a side note is Parallax planning on using USB C type connectors. It seems to be the new standard connector and yes you will have to buy yet another USB cable.

    Mike
  • evanhevanh Posts: 15,192
    The STM chip will do the UART over USB internally with hardware. Effectively a FTDI chip embedded on the same die.
  • cgraceycgracey Posts: 14,133
    evanh wrote: »
    The STM chip will do the UART over USB internally with hardware. Effectively a FTDI chip embedded on the same die.

    But does it pull in the FTDI USB driver for the OS?
  • There are many ways to do it (USB Virtual COM ports).

    I believe it was 1999 (the same year that I was introduced to the SX line), when I've brought a copy of a book named Parallel Port Complete, authored by Jan Axelson, because I was seeking for the most comprehensive information about PC's parallel port I could put my hands on, in order to design a specialized interface card, connecting PCs to IBM System/360 byte multiplexor channels.

    Since then, I've become one of Janet's fans.

    For the ones that yet don't know her, let me introduce Janet Louise (AKA Jan) Axelson and a little piece of her fantastic work:

    janaxelson.com/serport.htm#usb_virtual_com_ports

    There is much more to explore at Jan's website.

    Hope it helps a bit.

    Henrique
  • cgraceycgracey Posts: 14,133
    edited 2020-02-22 12:49
    Thanks, Yanomani. Yes, it seems that Windows has a generic approach to handling USB serial ports.

    From Jan's page:
    Dedicated-function controller
    Some USB controller chips have support for virtual COM-port communications built into the hardware. The device's CPU communicates with the controller via a serial or parallel interface. PC applications access the chips via drivers provided by the chip company. USB/serial adapter modules typically contain these chips.

    FTDI. Options with serial and parallel ports. Also modules for developing.

    MosChip Semiconductor Technology Ltd. USB to UART bridge.

    Prolific Technology. USB to Serial bridges.

    Silicon Laboratories. USB to UART bridge.

    General-purpose device controller with CDC firmware
    A device that uses just about any general-purpose full- or high-speed USB device controller can function as a virtual COM-port device. If the device firmware identifies the device as belonging to USB's communication devices class (CDC), the device can use the USB CDC driver included with Windows.


    Atmel
    Microchip Technology
    Libraries for Applications includes virtual COM-port firmware.

    Composite CDC devices
    To create a composite USB device that contains a CDC function, use an interface association descriptor to specify the CDC interfaces. Windows XP also requires the two hotfixes described in these articles:

    The Usbser.sys driver may not load when a USB device uses an IAD. Microsoft Knowledge Base article ID 918365. Updates usbser.sys to version 5.1.2600.2930.

    A Tablet PC that is running Windows XP Tablet PC Edition 2005 stops responding (hangs) when you put it into standby or into hibernation. Microsoft Knowledge Base article ID KB935892. Updates usbccgp.sys to version 5.1.2600.3116.

    USB host drivers
    Instead of using the USB CDC class driver, a general-purpose device controller can use a vendor-specific driver on the host PC. The driver can provide improved performance or support additional capabilities.

    HCC Embedded has CDC drivers for hosts and devices.

    MCCI has USB Serial Port Migration Products.

    USB CDC/ACM Class Driver for Windows. From Thesycon.
  • evanhevanh Posts: 15,192
    cgracey wrote: »
    evanh wrote: »
    The STM chip will do the UART over USB internally with hardware. Effectively a FTDI chip embedded on the same die.
    But does it pull in the FTDI USB driver for the OS?
    No need, Linux uses a generic driver for comports over USB, just like it does for USB mouse and keyboard too. I presume modern Windoze can, these days, do the same.

  • YanomaniYanomani Posts: 1,524
    edited 2020-02-22 13:06
    Yeah, P2 can do it too!

    Please, pay attention to the topic Maximizing Performance, there are ways to let windows know that data-transfer throughput could be improved.
  • RaymanRayman Posts: 13,897
    The way I remember it is that sending data over USB is fairly easy. You can even use HID protocol to do it, instead of CDC.

    The problem is implementing the VCP. That is where there are only proprietary things...

    So, sending data back and forth is relatively easy. Getting it to show up as an actual "COM" port may be hard.
  • jmgjmg Posts: 15,148
    cgracey wrote: »
    That would be awesome! I wonder if it's possible to do without using some company's proprietary driver on the OS side. Has serial communication via USB become generic to Windows?

    A discussion is here around HID, CDC and other methods. Note the comments around windows Bugs..
    https://www.microchip.com/forums/m962184.aspx

    I've seen some terminals support HID connect, as well as COMx connect.

    The other question is speed aka sustained data rates possible.
    I've not seen numbers for P2 USB throughout, as so far it's only been Mouse/Kbd.
    Maybe mass storage can give a handle on possible half duplex speed limits ?

    In the EFM8UB3 on P2D2, which uses a SiLabs windows side driver, and their VCPXpress library on the MCU, we tuned up to around 4Mb/s sustained, half duplex, but also managed higher peaks using the RAM as buffers.
    Using 2 stop bits, UART values of 6MBd, 8Mbd and 12Mbd all test ok, in bursts up to the buffer sizes.
    One reason to push this area (besides curiosity ;) ), is to allow a P2D2 to be used for early development of a design finally using FT232H/FT2232H - those HS-USB parts can sustain 12MBd continually.

  • jmgjmg Posts: 15,148
    Rayman wrote: »
    The way I remember it is that sending data over USB is fairly easy. You can even use HID protocol to do it, instead of CDC.
    The problem is implementing the VCP. That is where there are only proprietary things...
    So, sending data back and forth is relatively easy. Getting it to show up as an actual "COM" port may be hard.
    I think CDC shows up as COMx, so if you want driver-less links on the PC side, you could use that.
    (but note the comments around bugs, seems earlier windows were not the best, which is probably what drove the custom driver solutions into existence)

    The SiLabs debuggers use a CDC port, and on the EFM8-Debug host, that is currently fixed at 115200 baud. They do plan to allow Baud changes.


  • Cluso99Cluso99 Posts: 18,069
    Here's Windows 10 USB for you to ponder...

    At home my PC is rather old but at the time was a rather high-end Dell
    i7-2600 Quad Core 3.4GHz 8MB cache with internal Intel HD Graphics plus (released 2011), 8GB DDR3 1.3 or 1.6 GHz?, Nvidia GT530, C: SSD 256GB, D: 600GB, 3 x Acer 24" 1920x1080 monitors.

    At work my PC is 18 months old and has a reasonably high-end Dell computer with SSD and HDD. And my 2nd work PC is identical to my home PC.

    On all 3 PC's windoze regularly goes into limbo land while I am typing and you can wait seconds for the computer to catch up. I've had this problem on older cheapie low end (eg single/dual core 1.7GHz) laptops so always just said it was the slow old laptop.

    Two PC's have USB keyboards and the fastest has a WiFi keyboard with miniature USB-A dongle wifi.

    My point...
    If windows cannot always keep up with the keyboard, just be careful of throwing any decent data rates at the PC over USB.
  • Cluso99 wrote: »
    On all 3 PC's windoze regularly goes into limbo land while I am typing and you can wait seconds for the computer to catch up. I've had this problem on older cheapie low end (eg single/dual core 1.7GHz) laptops so always just said it was the slow old laptop.

    In my experience, that sort of nonsense generally has more to do with memory paging than anything else - as you type, somewhere on the path to getting the character on the screen, something needs to be loaded off the hard drive (especially programs using dynamic scripting languages have a very fragmented memory map and many layers of pointer indirection). Although in theory that shouldn't be that noticeable on SSD-equipped computers, so what do I know. Then again, I don't use Windows 10. I have never seen a Windows 10 computer that wasn't just freshly installed that performed well. It's just a bad OS.
  • cgraceycgracey Posts: 14,133
    Many GHz, much RAM, no cursor.

    It sure would be neat to get a handle on how to make the P2 look like a USB serial port to a host machine.
  • cgracey wrote: »
    It sure would be neat to get a handle on how to make the P2 look like a USB serial port to a host machine.

    Agree. Once the basics are understood, it should even be possible for the P2 to appear as multiple serial ports on the host.
Sign In or Register to comment.