USB serial gadget support on AT91SAM9G20

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

jaydeep
Posts: 1
Joined: Thu Aug 27, 2015 2:10 pm

USB serial gadget support on AT91SAM9G20

Fri Aug 28, 2015 8:22 am

I have a TS-8200-4200 board from Technologic systems with AT91SAM9G20 microprocessor.

Product specific links are as follows:
https://www.embeddedarm.com/products/bo ... -8200-4200
https://www.embeddedarm.com/products/bo ... ct=TS-4200

I want to use USB serial gadget support on this board. So, I had done following steps:

PART-1
- selected USB serial gadget option in menuconfig of kernel
- Compiled kernel and loaded it SD card
- Connected USB cable between board and linux host PC
Result - USB device not detected on host PC (tested with 'lsusb' and 'tail -f /var/log/syslog' commands)

PART-2
- So, i went through the source code and found out that board file has defined PC8 as VBUS sensing pin. but, looking at schematic i found that there was no VBUS sensing pin at USB device port on TS-8200-4200 board. So, i set VBUS sensing pin as 0 (not defined) in board file.
- Compiled kernel, loaded it to SD card and connected USB cable between board and PC.
Result - This time USB device was detected as serial gadget and i was able to access the serial port from /dev/ttyACM0 on host PC.

PROBLEM
board as USB device has random behavior. Sometimes, it gets detected by host PC and sometimes it gets failed. The problem is because of failure of USB device enumeration. When board does not detected by host PC, it shows following log on host PC.

Aug 28 11:34:29 vostro kernel: [ 7235.431710] usb 1-1.1: new full-speed USB device number 24 using ehci-pci
Aug 28 11:34:29 vostro kernel: [ 7235.503639] usb 1-1.1: device descriptor read/64, error -32
Aug 28 11:34:30 vostro kernel: [ 7235.679796] usb 1-1.1: device descriptor read/64, error -32
Aug 28 11:34:30 vostro kernel: [ 7235.856086] usb 1-1.1: new full-speed USB device number 25 using ehci-pci
Aug 28 11:34:30 vostro kernel: [ 7235.927995] usb 1-1.1: device descriptor read/64, error -32
Aug 28 11:34:30 vostro kernel: [ 7236.104294] usb 1-1.1: device descriptor read/64, error -32
Aug 28 11:34:30 vostro kernel: [ 7236.280422] usb 1-1.1: new full-speed USB device number 26 using ehci-pci
Aug 28 11:34:31 vostro kernel: [ 7236.688591] usb 1-1.1: device not accepting address 26, error -32
Aug 28 11:34:31 vostro kernel: [ 7236.760850] usb 1-1.1: new full-speed USB device number 27 using ehci-pci
Aug 28 11:34:31 vostro kernel: [ 7237.169029] usb 1-1.1: device not accepting address 27, error -32
Aug 28 11:34:31 vostro kernel: [ 7237.169182] hub 1-1:1.0: unable to enumerate USB device on port 1

The USB device driver for AT91SAM9G20 is located at drivers/usb/gadget/at91_udc.c. I am using linux kernel version 2.6.36.2 which is provided by board manufacturer.
For debugging purpose, i had put logs in IRQ function to find out which type of interrupts are received when USB cable is connected.

When board is detected as USB device successfully, following interrupts gets received in sequence one-by-one.
Resume --> End of Bus reset --> End point 0

When board is not detected, following interrupt sequence happens.
Resume --> End of Bus reset --> Suspend --> Resume --> Suspend --> Resume --> Suspend --> Resume --> Suspend --> Resume --> Suspend

Datasheet of AT91SAM9G20 says, if Suspend interrupt occuers if USB device is idle(no activity) for 3 ms.
I am confused why i am getting suspend interrupt ? :?

any ideas or pointers to solve this problem?
Thanks in advance.

Return to “Linux”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest