ATSAME70 how to debug code

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

Ok so I am using ATSAME70 and got very complicated project running...using Ethernet and USB modem for PPP etc. I am in a situation where the controller goes frozen and I have no clue what is going on. Interrupt seems to be working while stuck in this mode. As I can trigger a debug print statement by just typing a single char (trigger) in one of the uart ports. So basically when echoing the char back I call this debug print function to show my tasks etc. But I want know how I could use the Atmel ICE to debug? how could I find out exactly where it is getting stuck? is this possible?

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

Set some breakpoints in Atmel Studio and step thru the code ? Which hardware / tools do you use ? How did you manage firmware download ?

I'm curious to know how did you get so far in a project using Ethernet, tasks, etc without any debugging ... ?

Greetings from Germany

SAME newbie

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

I'd probably have each task output a character via the uart so i can see where it is spending most of the time. Then start drilling down. You can put breakpoints on specific functions to see if they get called.

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

ok thanks guys...it seems to the issue is a little more complicated now. I have the systick to generate 1ms timer interrupt...this I use to flag a task processing trigger. So there is a while loop that then goes through all tasks. I now see that this interrupt is not executing when the stall occurs. But certainly the UART interrupt is working. As I can then print certain things when I use RX char as trigger and call a printf function.

So it seems 'some interrupt' is blocking systick interrupt routine to execute! But this interrupt must be getting preempted by the UART interrupt...

Is there a way to see what interrupt? where how when? What is the system state? I have a feeling its the USB interrupt.

This bug has crept in by surprise indeed. uController only freezes upon receiving certain TCP packet.... 

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

Ok so I have finally found the fault. It was the USB host interrupt that was firing all the time when the issue was hit. Basically a pipe interrupt status was not being handled properly, I had mistakenly typed the incorrect register (DEV) instead of the (HST) ones. That meant the TXOUT interrupt was not being handled correctly. I have now perfected my USB host code using DMA and its great! I can do about 1-2MBps transfer using using USB modem on this little beast!

I have also implemented IP forwarding using NAT with my own TCP/IP stack. So the above transfer speed was read from Windows Resource Monitoring tool when I connected my laptop to the ethernet port of ATSAM board and a PPP usb modem to its USB port. So essentially the ATSAM board was acting as a router for my laptop and USB modem connected to ATSAM was the WAN. Works great...

Last Edited: Sat. Dec 31, 2016 - 02:43 AM