main function not executed in SAMD21 custom board

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

Dear all, 

I am quite new with ATMEL STUDIO. 

After checking some example codes from DEV Tools XPRO boards I have made my own PCB, including a SAMD21 MCU. Attached picture.

My first intentention is switching on a led. The initial code obtained from ATMEL START is loaded to the ucontroller. Debugging, I concentrate in the file "startup_samd21.c". Well most of the times I can't see the Yellow right arrow indicating the code execution. I have the feeling that the main call (where ports are initialized in another function) is not executed. And I find the yellow right arrow stuck in the while on the Dummy_Handler() function. Phisically I expect to measure some voltage after the main, that does not happen.

I am suspecting that the main function is not called. 

Can you please give some idea? 

Thank you. 

 

Attachment(s): 

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

It looks like it's hanging in libc_init_array(). Try clicking  "break all" in the debug menu to see where it's hanging

Jerry

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

jerryr wrote:

It looks like it's hanging in libc_init_array(). Try clicking  "break all" in the debug menu to see where it's hanging

Jerry

 

Hi Jerry. 

It branches to the Dummy_Handler() function from several points of the code.

Sometimes makes the for @Line229 and even some time has passed through the main but does not reach the code I could see something.

 

Then I found this thread https://community.atmel.com/foru...

and I am quite desperated, even after ugrading to 7.0.1931. I am not so skilled.

 

Ideas are welcome. 
Thank you. 

 

 

 

 

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

It looks like you'd have to provide your complete code in order to find the reason for bug

One can also look at the stack with the debugger to see what was happening at the time

While debugging open the I/O window and look at the NVIC registers. The ISPR is the Interrupt Set Pending Register. A bit in this register is set when a peripheral generates an interrupt, and the program jumps to the corresponding address in the interrupt vector, which you can see in the source file Device_Startup/startup_samd21.h. The bit numbers for each peripheral are in section 11.2.2 Interrupt Line Mapping of the datasheet. The flag in the ISPR is cleared when you clear the bit in the peripheral INTFLAG at the end of the interrupt handler.

The usual cause is that one hasn't defined a handler for the particular peripheral, and the default handler is always Dummy_Handler()

Good luck!

Jerry

PS I'm away from home and debugger for a week