On 01/10/2012 07:08, Jim Paris wrote:
> I have an implementation of FTDI's USB-to-serial protocol for LUFA
> that is pretty close to what you're asking. It emulates a FT232R.
> I wrote it for a few reasons:
>
> - I wanted something that was entirely interrupt-driven and did not
> rely on any polling.
Ditto.
> - I wanted software TX and RX queues that I could control easily, with
> reliable blocking/nonblocking options for when stuff gets buffered
> versus dropped in each direction.
Yep, that's more or less what my current USART implementation does. It
line-buffers on both input and output and does basic line discipline
processing - echoes input characters, does backspace handling and maps
\r & \n appropriately etc.
> - Existing CDC-ACM based virtual serial port implementations on
> various microcontrollers are always unreliable or slow for me with
> the Linux drivers. The ftdi_sio driver, on the other hand, is rock
> solid.
I haven't tried a simple CDC version yet and I'm not using Windows or
Linux, this is on Solaris ;-)
> Maybe you can use it as-is, or as an example. I just split it off
> from another project, and I don't have hardware handy to test at the
> moment, but it should work barring any stupid mistakes.
It enumerates OK and shows up as a device so the basics are working:
Oct 1 18:05:41 chill usba: [ID 912658
kern.info] USB 2.0 device
(usb403,6001) operating at full speed (USB 1.x) on USB 1.10 root hub:
device@1, usbftdi0 at bus address 2
Oct 1 18:05:41 chill usba: [ID 349649
kern.info] LUFA FT232
64033343837351113190
Oct 1 18:05:41 chill genunix: [ID 936769
kern.info] usbftdi0 is
/pci@0,0/pci108e,5351@1d,2/device@1
Oct 1 18:05:41 chill genunix: [ID 408114
kern.info]
/pci@0,0/pci108e,5351@1d,2/device@1 (usbftdi0) online
But when I open the device I get a timeout in the driver, so clearly
something is not quite right:
Oct 1 18:06:22 chill DESC: A USB device is not responding to host
tokens and the corresponding driver may not be able to recover from the
errors automatically.
Oct 1 18:06:23 chill DESC: A packet timeout was detected in the USB
device and the corresponding driver may not be able to recover from the
errors automatically.
But at least I have a working USART so I can stick in some debugging to
see what's going on -)