USB FTDI serial port

I'm trying to get an FTDI usb RS-485 serial port working on an Olimex A20 lime.
I've tried a number of different physical FTDI devices, including a Prolific device, the kernel won't recognize them no matter what I do.

I used svn.head -r 298609 and crochet w/ a derived version of cubieboard2 board profile and the ALLWINNER kernel.
I've tried the Olimex dtbs that get built from that profile, but the cubieboard2 dtb is the only one that gets me to a login prompt, which isn't 100%, so I ran down the "build a dtb" road.
I've successfully created a dtb, using gnu/dts/arm/sun7i-a20-olinuxino-lime.dts, but commenting out the usb otg port (I won't be using that port anyway) vbus detect pin configuration that causes the kernel to panic on boot.

If I load uftdi.ko manually after boot, and plug in the USB device, I get... nothing.

The port does appear to work when using a flash drive, before trying to plug in any serial device, but not after. I have to reboot to get the usb port to recognize anything after that.

If I turn on hw.usb.ehci.debug, and then plug in the FTDI device, I get console spew of:
Code:
[INDENT]ehci_root_intr: port 1 changed
ehci_set_hw_power:
ehci_roothub_exec: ehci after reset, status=0x00001801
ehci_disown: index=1 lowspeed=0[/INDENT]

Can anybody tell me what ehci_disown means? and how to deal with it?

I looked in the kernel code and the ehci_disown() function for any clues that I could glean, but I have no idea what I'm looking at/for.
I also looked at the the usb_quirks to see if I could see something that was applicable, but I don't...

Any help with this would be appreciated!
Without any suggestions, I'm at the end of the road, and I'll have to go back to Linux, which I'd rather not do.

TIA
Neal Horman
 
This is confusing. FTDI is a company, the company that freaked out over clones and made their drivers not work in interesting ways, leading many of us to abandon them in favor of other brands. Generally, these are USB RS232 adapters, not RS-485.

I have used numerous USB serial adapters on FreeBSD, including Prolific 2302, CPI 2102, CH340/341. I also have a couple of FTDI adapters, which I don't plan on using again, but they worked the last time I tried them.

All of these devices appear as /dev/cuaU0. Most of them only convert to 3.3V/5.0V logic level, not full RS-232 voltages of +/-15V.

So let's clarify what is going on. Are you really trying to use RS-485? Which version of FreeBSD? I can't even tell whether the adapter is being connected to a USB port on the ARM system, or whether it is being connected to a host system to try to talk to logic-level serial on the ARM system.
 
This is confusing. FTDI is a company, the company that freaked out over clones and made their drivers not work in interesting ways, leading many of us to abandon them in favor of other brands. Generally, these are USB RS232 adapters, not RS-485.

I have used numerous USB serial adapters on FreeBSD, including Prolific 2302, CPI 2102, CH340/341. I also have a couple of FTDI adapters, which I don't plan on using again, but they worked the last time I tried them.

All of these devices appear as /dev/cuaU0. Most of them only convert to 3.3V/5.0V logic level, not full RS-232 voltages of +/-15V.

So let's clarify what is going on. Are you really trying to use RS-485? Which version of FreeBSD? I can't even tell whether the adapter is being connected to a USB port on the ARM system, or whether it is being connected to a host system to try to talk to logic-level serial on the ARM system.

Sorry for any confusion.

Yep, this device is an RS-485 serial port (pdf documentation).
This a true FTDI product, not a clone.

FreeBSD HEAD revision 298609 as noted above.

To clarify,
I'm not asking for help about how to connect to the console port of the Olimex (target), I've already got that working. That's a no brainer for me, I work with serial TTL, RS-232/485/422 all day long, and sometimes in my sleep.

FreeBSD is up and running on the target, I can log into it both on the console, and via ssh.
I've figured out how to cross compile my apps for the target platform, and they appear to work correctly on the target.

I'm trying to use the USB RS-485 serial port with the Olimex device to talk to other Modbus RS-485 gadgets. That's also a no brainer for me. I've got that working on Linux ARM/x86 and FreeBSD x86.

This is not a general "it won't work on FreeBSD" problem, it works just fine on my many x86 and x86 vm boxen.

This is a, "it won't probe/attach/enumerate", or whatever (I'm not a kernel developer) on Olimex's ARM A20 Lime, problem.

From my spelunking, the offending code appears to be:
svn.head/sys/dev/usb/controller/ehci.c:ehci_roothub_exec():3448
Code:
                       if (!(v & EHCI_PS_PE) &&
                            (sc->sc_flags & EHCI_SCFLG_TT) == 0) {
                                /* Not a high speed device, give up ownership.*/
                                ehci_disown(sc, index, 0);
                                break;
                        }

Clearly, it says why it's disown'ing it, but, there is supposed to be some other code in the kernel, that picks up from here, and handles the low speed device, and deals with it.
I just don't know where, or how, that happens.
This clearly works on other well established platform targets.

Does it not work because there is something missing/wrong in the dts/dtb?, very possibly, or is a problem a platform specific kernel usb port driver problem, I think it it more likely.

But I'm not sure, that's why I'm asking for help, perhaps in the wrong place.


Regards
Neal Horman
 
Hello Neal,

Input is welcome from anyone with more information.

I am just starting to use FTDI 'stuff' on FreeBSD as a replacement for OSX.
I am just at the point where I am gathering information for code (C, C++, BASH (if needed), python (perhaps)) that will allow me to replicate what I currently do on OSX.
I am using:
Predator: ~: uname -a
FreeBSD Predator 11.2-RELEASE FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64



Currently, the needs are fairly simple.
  • On OSX I use Olimex ARM Tiny-H.
    I am replacing the Tiny-H with the Shikra from int3.cc.
  • On OSX I am using several consumer level USB hubs.
    I am replacing the consumer level USB hubs with the Big-7 from uugear.com.
  • On OSX I currently use a USB serial-to-TTL cable and I forget who made it at the moment.
    For FreeBSD, I hope to replace the serial-to-TTL cable with the Shikra.
Not surprisingly, FreeBSD does not recognize the Shikra. I am looking at what I have to do in order to interact with it.

Do you have any suggestions, guidelines, pointers, etc? If so, please let me know.
It sounds like you have a lot of the experience I am looking to acquire and develop.



=thoth=
 
Last edited:
Back
Top