Tim, I may be misunderstanding what you are saying– but it may be that you are confusing USB C Power Delivery host or device functionality with USB 2.0 / USB 3.0 data host or device functionality.
See this StackExchange question and answer <https://electronics.stackexchange.com/questions/554203/which-usb-spec-actually-defines-support-for-dual-role-device-type-c-or-usb-3-1>. Note that applies to USB 3.0, not USB 2.0. My understanding from reading the FUSB302 data sheet <https://www.onsemi.com/pdf/datasheet/fusb302b-d.pdf> is that it only implements USB C Power Delivery, and all USB 2.0/3.0 data transport connections must pass by the FUSB302 chip. See Figure 1 and the pinout in Figure 4, there are no D+/D- (USB 2.0) or TX1/TX2/RX1/RX2 connections to the FUSB302. So the FUSB302 cannot be the problem. When you switch the FUSB302 to host or device, it's only the USB C Power Delivery mode that switches. The USB2.0 OTG host or device modes are handled 100% in the SAMA5D2 drivers and only handle the data transport, not the Power Delivery mode. Ok, I'll give the CDC/ACM console thing a try and let you know. -adam On Wed, Aug 16, 2023 at 2:22 PM Tim Hardisty <t...@jti.uk.com> wrote: > Just FUSB302. It uses the toggle mode to work out a device or host attach > and the driver (yes, I authored/submitted that) handles the necessary > reconfiguration of the pull ups/downs and then signals, via a poll, to the > application layer (or, in my case, board-level driver code) what has > occurred to allow host power switching. To make it all work, I also added > (and submitted/have had merged) changes to the SAMA5 usb code to allow a > single physical port (A) to act as host or device switched in real time. It > works! Essentially OTG/dual-role functionality on a processor that doesn't > natively support it. > > Because CDC/ACM fundamentally works on my board, I think the FUSB302 stuff > is not to blame. Knowing you had it working as a console is good to know, > so its probably a mis-configuration somewhere, or a side-effect of the > changes I made (but, yes, had submitted so are now part of NuttX so *could* > raise as an issue: but I'd be the one to fix it lol). > > If you have a config that has console on CDC/ACM working to send me that > would be a great reference but only if it's not too much trouble to > (re)create. > > Once (if) I am sure it is not as simple as a config error I will raise is > as an issue but, for now, I'm inclined to think it's down to me. > > If I get nowhere tomorrow morning, I'll email you my config: a second > opinion would be much appreciated! > On 16/08/2023 21:36, Adam Feuer wrote: > > Are you using an FUSB302 with an FUSB340 (USB Switch)? My understanding is > that the FUSB302 only provides USB C power delivery along with a USB2.0/USB > 3.0 connection. That chip doesn't do anything to allow host and device on > the same port. As far as I know that's a function of the SAMA5D27 and the > NuttX drivers. I actually don't know if the SAMA5D2 UDPHS and UHPHS can > function simultaneously, or whether NuttX supports that. Did you get that > working? Or is that the problem you are trying to solve? > > So what's the problem with filing a bug? And didn't you add support for > the FUSB302 into NuttX? > > Anyway... we can talk on email for now. Do you have one that doesn't work? > I'd love it if you can send it to me. > > What I got working was CDC/ACM console and CDC/ECM ethernet over USB on > the same USB connection. Is that relevant to what you're looking for? If so > I can come up with a config that will do that. > > -adam > > On Wed, Aug 16, 2023 at 12:47 PM Tim Hardisty <t...@jti.uk.com> wrote: > >> Hi Adam, >> >> My board is pushing many boundaries as it allows usb host and device to >> coexist on a single physical port using an FUSB302 controller. It means it >> can never be as clear cut as it being a bug to report! >> >> If you happen to have a config that works for this it would be useful for >> sure, but I will plug away at it more tomorrow as the syslog port not >> behaving is probably a big clue. >> >> Regards, >> >> Tim. >> On 16/08/2023 20:13, Adam Feuer wrote: >> >> Hi Tim and Alan, >> >> I tested CDC/ACM when I was doing the CDC/ECM performance increases about >> 18 months ago. It seemed like everything worked fine on the Jupiter Nano, >> the SAMA5D2-XULT. I can put together a config for this again and test it... >> or send me yours, and I will adapt to Jupiter Nano. If we have a config >> that repros the problem, it should be possible to fix. >> >> Will you file a bug report so we can communicate there in public, and tag >> us or send the url by email? >> >> And then post your config there. I'll try it out and try to repro! >> >> -adam >> >> On Wed, Aug 16, 2023 at 10:56 AM Alan C. Assis <acas...@gmail.com> >> <acas...@gmail.com> wrote: >> >> >> Hi Tim, >> >> On 8/16/23, Tim Hardisty <t...@jti.uk.com.invalid> <t...@jti.uk.com.invalid> >> wrote: >> >> I am trying to get CDC/ACM working on my custom board so I can have a >> USB console. I have finally worked out the arcane set of CONFIG options >> needed, found the to-be-expected bugs/inconstencies with some of the >> SAMA5 code, that I have worked around for now (most are covered by >> disabling debug assertions for now)...and...finally get an NSH prompt on >> a Minicom terminal. >> >> Yay! >> >> But data transmission TO the board from Minicom is behaving very >> >> strangely. >> >> If I want to send '?' - to see what built-in apps I have, I need to type >> the '?' four times followed by 4 ENTERs, then I get the expected >> response. Eh? >> >> Tried Minicom on Windows/WSL or Ubuntu, and PuTTY. Minicom has been my >> console of choice, via serial, for ages. >> >> This seems very odd - it's 100% OK to the PC but 100% not OK from PC to >> board. >> >> In case it's related...SYSLOG to the original /dev/ttyS1 no longer >> works, and playing with SYSLOG configuration, seems to interfere with >> the CDC/ACM usb functionality as well by stopping it working if I dare >> to try to log to /dev/console! >> >> Anyone got any suggestions before I scream even louder!!!??? >> >> >> I never saw this behavior before! >> >> Since you also tested on Windows, it is not something in the computer >> messing with /dev/ttyACM0. >> >> The first thing I noticed is that none board has usbnsh inside >> boards/arm/sama5/xxxxx/configs/ so probably you are the first one to >> test this feature. >> >> So, start looking what the boards from other arch enable to get USB >> CDC/ACM working as console. >> And because there is no usbnsh board config for this chip, maybe it >> needs more investigation. >> >> I'm CC Adam, maybe he already tested it on Jupiter Nano board. >> >> BR, >> >> Alan >> >> >> -- >> >> Regards, >> >> >> >> Tim Hardisty >> >> [image: A picture containing text, clipart Description automatically >> generated] >> >> +44 (0) 1305 534535 >> >> <http://www.jti.uk.com/> >> >> JTi.uk.com <https://www.jti.uk.com/> >> >> <https://www.facebook.com/JTinnovations/> >> >> \JTinnovations <https://www.facebook.com/JTinnovations/> >> >> JT Innovations Ltd. >> >> Registered office: 36 East St, Weymouth, Dorset, DT3 4DT, UK. >> >> Company number 7619086 >> >> VAT Registration GB 111 7906 35 >> >> >> > > > -- > Adam Feuer <a...@starcat.io> > > -- > > Regards, > > > > Tim Hardisty > > [image: A picture containing text, clipart Description automatically > generated] > > +44 (0) 1305 534535 > > <http://www.jti.uk.com/> > > JTi.uk.com <https://www.jti.uk.com/> > > <https://www.facebook.com/JTinnovations/> > > \JTinnovations <https://www.facebook.com/JTinnovations/> > > JT Innovations Ltd. > > Registered office: 36 East St, Weymouth, Dorset, DT3 4DT, UK. > > Company number 7619086 > > VAT Registration GB 111 7906 35 > > > -- Adam Feuer <a...@starcat.io>