ASF4 USB CDC

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings,

 

I have been working on an ASF4 project using the ATSAME53N20, and my own board that I built. 

I have been successfully adding one library at a time with ASF4, writing the code, and testing it. So far, that is working well. 

I am now trying to implement the USB port as a CDC class. There are a number of drivers and middleware options, and I'm not sure which all I need. 

Also, I cannot seem to find any example code or documentation on how to implement this. There is a lot of info on ASF3, but that doesn't help.

Can someone please point me in the right direction?

Thanks,

Rick

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rick,

 

Attached a zip of the current Atmel Studio ASFv4 project that I am currently working on, it is however for the atsamd21

 

In this I have used the ACM (Asynchronous Communications) subset of the USB CDC class to implement a Virtual COM port over USB. 

 

I really battled quite a bit to get it going, till I figured that I had to set the USB clock to 48MHz, and the CPU to 24MHz

 

As far as I remember I originally just added the cdc_acm in atmel start, and start then added all the dependants automatically

 

Hope it helps you

 

Gert

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gert,

 

Hey, thanks so much for sending me that. 

I tested your code on my board after remapping it for the other processor, still didn't work. 

 

I tracked down everything on my board and discovered that the USB port didn't like a couple of caps I had on the USB lines. 

Now I do get some enumeration, but it does not load a driver on a windows 7 PC. 

 

What drivers are you using? Is this supposed to use the MS Windows CDC driver?

By default, the USB uses vendor code 0x3B, Product code 0x2404, and Device code 0x100. Did you stick with these?

 

Thanks,

Rick

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gert,

 

I did get the port to work using your code with the A/D stuff removed. 

I just stuck a "Hello World" in the snprintf statement. 

 

On the connected PC, I used device manager to automatically scan for a driver. 

That worked, although it was an unsigned microchip driver. 

I'd like to figure out how to add an inf file to the customer's PC so they can install easily. 

 

Also, do you have any example using this with the usb/serial callback functions?

 

Thanks,

Rick

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rick,

 

As far as I remember I didn't have to install a driver on my windows 7, it picked up a new com port and went off into the wild blue yonder and automatically found a driver to use which it then automatically installed,  see the attached screenshot for what it installed

 

In my program itself, the ONLY thing I needed to get running for what I needed with the USB is : cdcdf_acm_write((uint8_t *)usb_serial_port_write_buffer, strlen(usb_serial_port_write_buffer));

 

I didnt do anything else with the USB, sorry I cant help with that

 

Gert

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No problem. Thanks again for the help.