Problem with USB CDC in custom project

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

I'm trying to get a project set up with a USB CDC virtual com port on a SAME70. I started with Atmel START, generated some code, and verified that it works.

 

Rather than work directly with the project/folder structure generated by Atmel START I decided to create my own empty project. I then added everything that Atmel start generated as a sub-folder in my project. I modified all the Tool chain settings accordingly (include folders & path to linker script). I have also retained the original Atmel START project/solution files so I can edit/add components as needed.

 

At this point, my project is almost exactly identical to what Atmel START generated, except that I have all the Atmel START source in a sub-folder. Everything compiles and links OK. The code runs through the driver initialisations OK, but hard faults as soon as I plug in the USB. The hard fault occurs at line 672 in hpl_usbhs.c;

memcpy(ptr_dest, ptr_src, trans_next);

The address passed to memcpy look ok to me (dest=0xa0100000, src=0x2040008a), so I'm not even sure why it is hard faulting.

 

Any idea why the original project would work, but my custom project with exactly the same source files causes a hard fault? I've been working on this issue for 2 days and still haven't been able to solve it.

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

For anyone else facing this issue, I found the solution by doing a diff on the .cproj files.

 

My .cproj file was missing;

<armgcc.linker.general.UseNewlibNano>True</armgcc.linker.general.UseNewlibNano>

I couldn't find a way to configure this through the project properties in Atmel Studio, so I just added it directly to the .cproj file and it works.

 

Ah man. I want my two days back.