This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AT91SAM7S USB corruption


For the past two weeks I've been hunting down a bug to do with the USB on my AT91SAM7S128 board (Rev B silicon). I've been getting random corruptions on my OUT endpoint (So Rx, from the device point of view). These corruptions occur seemingly randomly, after transmitting anywhere between a few kbs of data up to 100MB of data. At first I was convinced it was either libusb or my code but after analyzing the outbound USB traffic with VMWare and Micah Dowty's excellent vusb analyzer, neither was seemingly to blame. All outbound USB packets from the host were fine, none of them contained corruptions.

So I started printing the receive buffer the moment I got the Rx interrupt, and the corruptions were right there. This leads me to believe there might be a bug somewhere in the AT91SAM7S USB device driver. This problem seems to occur faster the higher the data throughput is, almost vanishing when I add a lot of debug printfs, slowing the system down.

I triple checked, and I'm not running multiple receive USB operations at the same time. I also set a watchpoint on the receive buffer to make sure I wasn't touching it somewhere, but the only hits I got were from the USB driver. The corruptions seem to be somewhat consistent in that they usually consist of the value 8F AF or CC ED being injected in the first 16 bytes (usually the first four) of the buffer, but sometimes there's also just an extra 00 in there that shouldn't be there. 

I also tried compiling with -O1 instead of -O2, which didn't seem to help at all. I'm compiling with the following GCC:

Target: arm-eabi
Configured with: ../configure --target=arm-eabi --prefix=/Users/erant/Projects/arm-eabi/ --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-gxx-include-dir=/Users/erant/Projects/arm-eabi/arm-eabi/include --disable-hosted-libstdcxx --disable-__cxa_atexit
Thread model: single
gcc version 4.4.3 20100116 (prerelease) (GCC)

If anyone has any thoughts, I'd be happy to hear them.

Thanks,

-- Erant

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]