I'm excited to be able to move forward with developing on a new microcontroller (ATSAM4S4A-MU). It's been a fun run, and I'm finally starting to get the hang of it. However I've been having two issues so far:
1) Code I upload to the chip wont run without first disconnecting and then re-connecting power. Is there any way to fix this so it runs right after upload?
2) I have implemented the USB CDC example on this chip and I was successfully able to toggle some LED's on my board over UART. However, the device disconnects and then reconnects after only a few seconds whether I'm using the bus or not. HOWEVER, I am able to get it to run without disconnecting at all when I use AS7's debug feature. I have ruled the possibility of an electrical issue as the device will still disconnect when the ICE programmer is hooked up but not debugging. Also, when I start debugging and then disconnect the ICE programmer the program runs stable as well. My figuring is that it has to do with some sort of state the device is left in after programming (like not being reset properly). Any advice?
Specs: Win10, Atmel ICE, AS7, ATSAM4S4A-MU.
Code (the code editor isn't working sorry for the crappy screenshot). Initially I posted this in AVRFreaks so sorry for the double post.
Solution: Nobody tells you that the watch dog timer is enabled by default. Disable the WDT to get things to work.