USB CDC Echo example project not working

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

Hello,

My software versions are Atmel Studio (7.0.1417), ASF (3.35.1), and Atmel Start (1.0.102.0).  My hardware is the SAMG55 Xplained Pro development board.  I opened the example start project "USB CDC Echo" program.  Once loaded on the target the USB will enumerate and I see "Communication Device Class ASF example (COM6)" in my Windows 7 Device Manager.  This all seems fine, except serial communications do not work.  The program is stuck in the function cdc_acm_example() at the while loop, meaning cdcdf_acm_is_enabled() always returns false.  Has anyone else seen this?  Is there a fix?   

 

void cdcd_acm_example(void)

{

    while (!cdcdf_acm_is_enabled()) {

        // wait cdc acm to be installed

    };

 

    cdcdf_acm_register_callback(CDCDF_ACM_CB_READ, (FUNC_PTR)usb_device_cb_bulk_out);

    cdcdf_acm_register_callback(CDCDF_ACM_CB_WRITE, (FUNC_PTR)usb_device_cb_bulk_in);

    cdcdf_acm_register_callback(CDCDF_ACM_CB_STATE_C, (FUNC_PTR)usb_device_cb_state_c);

 

    while (1) {

    }

}

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

dmccreight wrote:
Is there a fix?   
 

The answer appears to be in the code comment:

    // wait cdc acm to be installed

So have you installed CDC ACM ?

 

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

I don't think that is the issue for the following reason.  I opened another example project, (File->example project...) "USB Device CDC Example - SAMG55 Xplained pro.  I build and load this project and it works as advertised.  I see the same information in windows device manager, "Communication Device Class ASF example (COM6)".  The only difference is when the USB enumerates it asks where I want to attach it (I'm running a VM) and uses the name "Atmel CDC Virtual Com".  When I attach the USB cable for the example Atmel Start project is uses the name "Atmel modem".  Maybe this is a clue, I have no idea.  

 

So the ASF example project works and the Atmel Start project does not.  The ASF project appears to be structured differently (i.e. different HAL) so it's hard to compare the two projects and look for differences.

 

I did re-install the driver using the file atmel_devices_cdc I found in the ASF example project.  This had no effect.

 

Any suggestions or feedback would be greatly appreciated 

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

dmccreight wrote:
 cdcdf_acm_is_enabled() always returns false.  

Investigate what causes it to do that

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

I can and will if time permits.  The point here is I have a development platform to evaluate the SAMG55 and it looks like their example project for USB doesn't work.  I'm looking for a sanity check from someone else who got this example project to work or also had the same problem.

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

Note that the stupidity of this site's organisation places the only ASF forum under AVR - the 8-bit microcontroller section.

 

To find people who actually know about the SAMG55, you may be better asking in the Cortex-A forum:

 

https://community.atmel.com/forums/atmel-cortex-mpus

 

Do you have distributor and/or Atmel FAE support?

 

EDIT

 

Ah - so the SAMG55 is actually a Cortex-M4:

 

https://community.atmel.com/forums/atmel-cortex-m-mcus

Last Edited: Tue. Sep 5, 2017 - 04:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In case you forgot, you have to tell the PC program which com port to use.

 

You should be able to use any PC program that uses com ports.  Terminal emulators, for example.

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

In the post #3, I'm not sure which parts are referring to the Host, and which to the Target.

 

It looks like there may be some confusion ...

 

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

Hi,  I had a similar issue just about a week ago.  The ASF3 example works easily but the ASF4/START solution does not.  On my Win10  computer I can see in Device Manager that the virtual com port attempts to enumerate but then reports a timeout.  I emailed to Microchip for support and got a response that they will try to duplicate it.  I'm still waiting.

 

I do see the code gets stuck in the while loop waiting for cdc acm to be installed.  But I'm not sure why that never happens.

 

 

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

I finally got back to this project and was able to get the example to work by doing two things. My hardware is the ATSAMG55 XP board using ASF4/START.  I see some new changes to START were made in October so I was hopeful it might resolve the problem.  However, it didn't seem to improve the example.

 

To get the example to work I did the following:

1) Change the core clock frequency from its default of 8MHz to 24MHz.

 

After doing this, the port will enumerate on my Win10 PC. But it won't echo.

 

2) Change the max supported end point from its default of 2 to 5.

 

After doing this, the echo works.

 

The echo of characters in the ASF4 example appears to be different than under the ASF3 wizard example.  In ASF3 it would echo between the EDBG port and the USB port.  Under ASF4 it only echos between the USB port so that whatever you type in the terminal window shows up back in the window.  The comments are not clear (to me) about this change in behavior.

 

Added attachments show in START what I changed.

 

 

Last Edited: Mon. Nov 20, 2017 - 02:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tarribred wrote:
Under ASF4 it only echos between the USB port so that whatever you type in the terminal window shows up back in the window

That sounds like the usual meaning of "echo"