Tim, I used the CDC/ACM as the console device.
Will you file a bug and put all that in the bug, and then we can communicate there? -adam On Wed, Aug 16, 2023 at 12:25 PM Tim Hardisty <t...@jti.uk.com> wrote: > Thanks for replying Adam. > > Did you try CDC/ACM for console, or just CDC/ACM itself? CDC/ACM does work > fine using the usbserial example app, it's just using it as a console > that's tripping me up. > > I was drafting a different email before this topic, and may have missed > some relevant information as a result. Here's what I'd drafted: > > --- > > I am trying to set my custom SAMA5D2 board up to use a USB console rather > than UART1. UART1 is the default for all other boards in the repo, with no > SAMA5 boards using a serial console that I can find. > > This is what I've tried so far. > > 1) Add CDC/ACM as a USB device. > > When I run the example "usbserial" app, the cdc/acm device is registered > as /dev/ttyACM0 as expected, and I can connect to it from my PC where the > (USB) COM port is correctly instantiated, and characters are exchanged. > > Good! > > I note that /dev/ttyACM0 is not present in the /dev list however, as > usbserial registers it. > > 2) So I added a call to cdcecm_initialize(0, NULL) to my board bringup. > That makes sure that /dev/ttyACM0 is there at start up, but the usbserial > example app is no longer happy as it wants to register the device itself. > OK, no problem, but at least both these show that the fundamental USB + > CDC/ACM stuff works. > > Now to move console to CDC/ACM. I first removed the board_bringup call to > register and init the cdc/acm device as that will conflict. > > 3) Leave UART1 as a console, check the option to select > CONFIG_CDCACM_CONSOLE. This fails (via a DEBUGASSERT) because the attempt > to register the usb device as /dev/console. Error 16 - Device or Resource > Busy. Probably because UART1 has already claimed /dev/console. Fair enough! > > 4) Select the option CONFIG_NO_SERIAL_CONSOLE instead. That's consistent > with a few search hits on how to do this (thanks Alan C. Cassis as ever for > your videos!) > > This trips up because of a #error in sam_lowput.c since no UART or USART > is defined for console (i.e. it really is expecting there to be a serial > console). It's in lowput.c and I've fixed that by comparing to samv7 and, > for now, disabling debug assertions. > > ------------------ > Stopped that email draft at this point and switched tack as I'd found I > could get it to work but with the problem now reported. > > > 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>