SAM4 USB working for device RX but can't transmit to host

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

MikeMyhre
Posts: 34
Joined: Sun Jun 30, 2013 7:08 pm

SAM4 USB working for device RX but can't transmit to host

Sat Aug 08, 2015 7:26 pm

I have USB working with CDC for the most part. I can plug in the device, it shows in Device manager after correctly installing. I can type characters in my virtual serial port on the host computer and they are received in my device correctly (udi_cdc_getc() function).

When I try and echo the character back (either with udi_cdc_putc or udi_cdc_write_buf() functions), it doesn't make it back to the host computer. I have followed the function call to the point it goes into the buffer, but doesn't seem to go out (existing job). The udi_cdc_data_sent callback doesn't get called except for when I plug in the device.

Any ideas on what could be my problem?

Thanks,

Mike
MikeMyhre
Posts: 34
Joined: Sun Jun 30, 2013 7:08 pm

Re: SAM4 USB working for device RX but can't transmit to hos

Thu Aug 20, 2015 8:09 pm

I am still having problems with this and I am not sure why it doesn't work.
Here is what I know:

I am trying to use the SAM4L part as a USB device type CDC.
I have configured the endpoints and company VID/PID info.
The clock is enabled at 48MHZ via 12MHZ crystal and PLL.
When I plug in the USB to a computer, I get the USB plugin tone and everything looks right on the Host computer end (MFG info, VID/PID, etc. were retrieved from the device.
I receive a character from the first endpoint (typed on the host computer).
I then reply using the ASF udi_cdc_putc(cc) function. This in turn calls the udi_cdc_multi_putc(cc) function which writes the endpoint 1 buffer and puts the count in memory. It clears the FIFOCON bit and udd_disable_busy_bank0(epnum) functions. Both show the bits in the USBC registers being cleared. It then enables interrupts and that is where it sits.

From what I understand, the DMA via the HSB should empty the packet and flag it as sent.
This endpoint has USBC_UECON1.TXINE = 1, but no RXOUTE bit set.
From the ATMEL datasheet, it looks like I am receiving characters from the HOST end of the USB pipe on an IN endpoint and I am attempting to send characters back to the HOST on an OUT endpoint.

What am I missing here? It all seems clear, but it is acting like I don't have a clock, DMA or interrupts set right (buffer waiting to be sent with everything looking right).

Thanks,

Mike Myhre
MikeMyhre
Posts: 34
Joined: Sun Jun 30, 2013 7:08 pm

Re: SAM4 USB working for device RX but can't transmit to hos

Thu Aug 27, 2015 6:09 pm

I resolved the problem, but not sure exactly where it was. I upgraded to the most recent ASF version and it solved the issue. I was using 3.15 and upgraded to 3.26. I thought I was at the most current, but I guess not.

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests