AT91SAM7 USB Driver

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

AT91SAM7 USB Driver

Postby lbednarz » Tue Apr 16, 2013 12:38 pm

Hello,

During last days I worked on usb driver for AT91SAM7S. The driver seems to work well with standard test code from STM32 USB_CDC testhall example.
It was tested on my custom board (AT91SAM7S256), so I'm attaching only needed files. Modified standard hal files was taken from trunk r5591.
I hope it will be useful:)

Regards,
lb
Attachments
at91sam7_usb.zip
(35.78 KiB) Downloaded 219 times

User avatar
Giovanni
Site Admin
Posts: 13125
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: AT91SAM7 USB Driver

Postby Giovanni » Tue Apr 16, 2013 7:52 pm

Hi,

Great work, I am looking at the changes to the common level, it looks like you are trying to fix some inherent problem not just adapt it for the SAM7S. Could you explain what the problem is and if there is any reason to keep the previous "early" mode?
Apparently you delayed the configuration event to after the zero packet send, is this correct?

Giovanni

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: AT91SAM7 USB Driver

Postby lbednarz » Tue Apr 16, 2013 9:50 pm

Hi Giovanni,

I'll check it carefully and explain (if I can:)) tomorrow, because I have no board at home. I'm not entirely sure that delayed set configuration is really needed. If I remember well, there was some problem with that. Anyway there is a problem with port locking in usb_packet_write_from_queue() function (mcu stucks), but I don't know, how to solve it correctly, so temporarily I commented port locking.

lb

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: AT91SAM7 USB Driver

Postby lbednarz » Wed Apr 17, 2013 9:00 am

I misunderstood documentation and I thought, that setting configured state must be done after status packet, so early and late mode won't be needed here. I'm checking that now and it works fine without late mode.

But I think there is a bug in _usb_ep0in() when device sends descriptor, which size is multiply of endpoint size, If so, device sends 0-size packet infinitely. So I added USB_EP0_WAITING_TX0 state as workaround.
I think it works in STM32, because endpoint 0 size is 64 bytes, so that path of code is never executed, but I didn't checked it carefully and I could be wrong.

User avatar
Giovanni
Site Admin
Posts: 13125
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: AT91SAM7 USB Driver

Postby Giovanni » Sun Apr 28, 2013 2:34 pm

Hi,

Sorry for the delay, I just found time during this weekend.

I verified the problem with the state machine, your change was correct (I modified it a little bit in order to avoid an extra condition). Could you verify the change using your new driver?

I didn't merge the late/early change since you wrote it was no more required.

Giovanni

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: AT91SAM7 USB Driver

Postby lbednarz » Mon Apr 29, 2013 10:05 am

Hi,

I'll test the driver within a few days.

lb

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: AT91SAM7 USB Driver

Postby lbednarz » Mon May 06, 2013 11:06 am

Hi,

I'm testing now usb driver from revision 5651 (only usb.c file) and it seems to work well on AT91SAM7S256.

lb


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 5 guests