SAM V71 Xplained Ultra board - USB data trouble

AT91EB40A, EB55, EB42 Evaluation Boards , AT91RM9200-DK, RM3400-DK will be the focus of the discussions: hardware guidance, embedded software, use,...

Moderator: nferre

MGen
Posts: 12
Joined: Thu Jul 02, 2015 3:33 pm

SAM V71 Xplained Ultra board - USB data trouble

Sat Dec 19, 2015 12:51 am

Hi Folks!

Unfortunately I have quite many troubles with my board and the examples... :? The current is the following.

I started to develop the USB interface for my project. I thought I would use simple CDC first (the USB CDC example seems to work), since currently I need only easy data transfer to the PC app. (Image from a sensor. Not realtime, buffered yet.)
I "traced" (to be fast, into memory) the CDC example and created my own based on this (except that I use "vendor class"). I use libusb-win32 to commnuicate with it, I have used that before.

Everything goes fine until I send data with a control transfer (usb_control_msg()). The setup packet is read by the ARM with two 32-bit reads from the USBHS FIFO, it works. But when it wants to read the data part using 8-bit access, it reads the first 4 byte repeated for infinite. (After I have fixed the example, because it was buggy about the data size. Hm.) Then I tried to read data with 32-bit accesses and it reads the first 8 bytes well, then last 4 byte is repeated. 16-bit acces won't do anything better.
Writing to FIFO works as intended (8-bits), but reading fails.

Any thoughts?

(I don't think Atmel Studio 7 has any influence on this symptom. It works quite well since it's not beta.)
Thanks!
Zoltan
MGen
Posts: 12
Joined: Thu Jul 02, 2015 3:33 pm

Re: SAM V71 Xplained Ultra board - USB data trouble

Sat Dec 19, 2015 3:32 am

Damnit! The Atmel Software Package for AS has bug. :( I am using "studio 1.5", but have "studio 1.4" and 1.4 is okay.
I give the details.

In studio 1.4:
libraries/libusb/common/core/USBD_HAL.c

Code: Select all

static void UDPHS_EndpointHandler(uint8_t bEndpoint)
{
    ...
    /* In read state */
        else
        {
            wPktSize = USBHS_ByteCount(pUdp, bEndpoint);

            TRACE_DEBUG_WP("%d ", wPktSize);
            UDPHS_ReadPayload(bEndpoint, wPktSize);
            USBHS_AckEpInterrupt(pUdp, bEndpoint, USBHS_DEVEPTICR_RXOUTIC);
            
            /* Check if transfer is finished */
In studio 1.5:

Code: Select all

static void UDPHS_EndpointHandler(uint8_t bEndpoint)
{
    ...
                /* In read state */
		else {
			TRACE_DEBUG_WP("%d ", wPktSize);

			/*Acknowledge Received OUT Data Interrupt*/
			USBHS_AckEpInterrupt(pUdp, bEndpoint, USBHS_DEVEPTICR_RXOUTIC);

			wPktSize = USBHS_ByteCount(pUdp, bEndpoint);
			UDPHS_ReadPayload(bEndpoint, wPktSize);

			/*Free the current bank and to switch to the next bank (If any).*/
			if (type != USBHS_DEVEPTCFG_EPTYPE_CTRL >> USBHS_DEVEPTCFG_EPTYPE_Pos)
				USBHS_DisableEPIntType(pUdp, bEndpoint, USBHS_DEVEPTIDR_FIFOCONC);

			/* Check if transfer is finished */ 
Ack'ing the interrupt before data read caused the symptom. Plus, wPktSize is uninitialized at TRACE_DEBUG_WP and reading USBHS_ByteCount() gave back 0 even if I have sent data payload.

With proper line order, data come as intended. Bah :(
bluematrix
Posts: 1
Joined: Mon Mar 14, 2016 2:23 pm

Re: SAM V71 Xplained Ultra board - USB data trouble

Mon Mar 14, 2016 2:27 pm

did you found a solution?

Return to “Evaluation and Development Boards”

Who is online

Users browsing this forum: No registered users and 1 guest