Problem communicating over USB-CDC

classic Classic list List threaded Threaded
5 messages Options
Richard Graham Richard Graham
Reply | Threaded
Open this post in threaded view
|

Problem communicating over USB-CDC

Hi,

I have finally got elua built and working on my custom board (uses a
AVR32UC3-0512. It was a bit of a challenge since I have a slightly
unusual clock configuration. But that is sorted now. But I am not able
to get a console up over the USB-CDC interface. I was wondering if
anyone would have any hints or debugging suggestions.

When connected the USB device enumerates and shows up on linux as
/dev/ttyACM0. lsusb shows the device as "03eb:2307 Atmel Corp.". I am
able to connect to it with a terminal program. I just can't send or
receive any data. The port settings are correct and I have tried various
terminal programs and also tried it on windows. I also tried forcing the
usbserial module to manage the device rather than cdc_acm but that
doesn't make any difference. Shell is ofcourse included in my board
configuration build file.

I am programming and debugging using an AvrDragon over JTAG. Using gdb I
am able to see that code is running and when I interrupt it usually find
it in 'repearstat' function, line 1035 of lparser.c.

The debugger continuously shows packets being received. Strangely after
each packet it shows a joystick key pressed event. I don't know where
this is coming from -- I don't think there is any code in there anything
to do with a joystick.

I have also tried spying on the raw usb data with usbmon and wireshark.
I have seen 64 byte data packets going back and forward when the device
is plugged in and when the serial connection is opened. However I
haven't been able to make any sense of these yet.

Any thoughts would be most appreciated. Thanks!

--
Richard Graham

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: Problem communicating over USB-CDC

On 07/12/2013, Richard Graham <[hidden email]> wrote:
> Hi,
>
> I have finally got elua built and working on my custom board (uses a
> AVR32UC3-0512. It was a bit of a challenge since I have a slightly
> unusual clock configuration. But that is sorted now. But I am not able
> to get a console up over the USB-CDC interface. I was wondering if
> anyone would have any hints or debugging suggestions.

Hi
  Yes, the USB-CDC module has some problems. When talking to LInux it
takes 8 seconds to initialize and be usable, but is then stable for
us. This means you miss the greeting from the shell but can then
provoke a prompt by hitting Enter.
  With Windows instead, you need to do a little dance to get Win and
the USBCDC talking to each other if you reset the board - see the
finale remarks on the page
https://en.wikibooks.org/wiki/Mizar32/USB
  Note that I don't take responsability for this module. I was forced
to include this new software in the last days before a software
release, which is always a bad idea, and the idea of opening up the
code to debug it is not appealing. When it works it is very fast,
something like a ten megabaud serial port, but it seems to have some
initialization issues.
  One hack that sped up the init was to increase the VTMR frequency
from 10 to 100 Hz, which costs you a little CPU but accelerates the
USB CDC init with Linux
  If you find other solutions, do le us know

Cheers

    m

Let us know if you
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: Problem communicating over USB-CDC

On 07/12/2013, Martin Guy <[hidden email]> wrote:
>   One hack that sped up the init was to increase the VTMR frequency
> from 10 to 100 Hz, which costs you a little CPU but accelerates the
> USB CDC init with Linux

Note that you do need Virtual Timers to be configured in, as the
USB-CDC, like the ethernet, uses this to get 10 interrupts a second to
service events from the outside world (which is why changing its
frequency speeds things up).  If you had virtual timers deconfigured
that would probably nobble the USBCDC module too.  Just a thought...

    M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Richard Graham Richard Graham
Reply | Threaded
Open this post in threaded view
|

Re: Problem communicating over USB-CDC

Hi,

Thanks for that suggestion. I did notice the delay on init but it
doesn't bother me to much. I do have 4 virtual timers and I just tried
them at 100 Hz, but it doesn't make any difference.

Next step is configuring some TX/RX LEDs to help with debugging. Would
it be satisfactory to hack that into uart.c, or would there be some
better way?

Cheers,
--
Richard


On 12/07/2013 10:41 AM, Martin Guy wrote:

> On 07/12/2013, Martin Guy <[hidden email]> wrote:
>>   One hack that sped up the init was to increase the VTMR frequency
>> from 10 to 100 Hz, which costs you a little CPU but accelerates the
>> USB CDC init with Linux
>
> Note that you do need Virtual Timers to be configured in, as the
> USB-CDC, like the ethernet, uses this to get 10 interrupts a second to
> service events from the outside world (which is why changing its
> frequency speeds things up).  If you had virtual timers deconfigured
> that would probably nobble the USBCDC module too.  Just a thought...
>
>     M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: Problem communicating over USB-CDC

On 09/12/2013, Richard Graham <[hidden email]> wrote:
> Hi,
>
> Thanks for that suggestion. I did notice the delay on init but it
> doesn't bother me to much. I do have 4 virtual timers and I just tried
> them at 100 Hz, but it doesn't make any difference.
>
> Next step is configuring some TX/RX LEDs to help with debugging. Would
> it be satisfactory to hack that into uart.c, or would there be some
> better way?

No idea.

You do have
# define CON_UART_ID        CDC_UART_ID
in your _conf file I presume?

To see whether it's a console issue or a USB serial port issue, you
can use uart.write (or whatever it's called) using serial port number
176 instead of 0 or 1 or VIRT* - that should send stuff to the USB
serial port if it is working.  It doesn't seem to have a symbolic name
in eLua.

    M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev