AT32UC3L016 program isn't starting after power reset

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

I have a problem with my AT32UC3L016, my program is running when I use my debugger (JTAG ICE 3). But when I remove the power of my board  and I put it back, my program doesn't start. I have already flashed my program inside, with no effects.

 

My Atmel Studio version is Atmel Studio 7 (Version: 7.0.1006 - ).

 

Thanks for answers.

 

 

 

Alexandre Höhn
ETML
Switzerland

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

I have the same problem with AT32UC3C1512C. Flashing compiled .elf file using batchisp and starting it with "start reset 0" works fine, but after power reset my application doesn't restart. I inherited an old version of the same .elf file (without source code), which installs and restarts automatically after power reset. The bootloader configuration words in user flash memory are identical to default (Word1=0xE11EFFD7, Word2=0x929E0E62 for UC3 C1512C) in both cases. Do I need to set some flag/option in Atmel Studio 7 to make my application restart after reset?

 

 

 

 

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

My problem is resolved, it was my reset circuit. My reset time was apparently too long. I removed the reset circuit(Resistor and Condensator) and my program starts. This microcontroler seems to have a internal reset circuit so try to remove yours. Let me know if it worked ;)

Alexandre Höhn
ETML
Switzerland

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

Unfortunately I am almost completely ignorant about the hardware side (circuits etc), my background is in software/vision algorithms. My camera flash is controlled by a chip that was programmed by a former colleague (no longer reachable). I have his source code which compiles into an .elf file, and an old .elf which is slightly different (its exact source was not under version control, bad practice).

 

Both old and new .elf files can be flashed by batchisp and run fine, with identical functionality, until a power reset. The old version resumes automatically, but the new one doesn't restart the application and needs to be manually restarted using batchisp's "start reset 0" command, after which it works properly again until the next power reset. The AT32UC3C1512C board is the same in both cases, so it is likely not a hardware issue.

 

The bootloader configurations in user flash memory (mentioned in bootloader documentation) are the same in both cases, and the application code looks almost identical in disassembly. I suspect I am missing some option in Atmel Studio 7 to make the new .elf restartable after reset. Any ideas about where I might need to look? Many thanks!

 

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

I made some progress in debugging the issue. I created a dumbed down version of the program that I can compile and flash, and which is robust to power resets. Thus the problem lies somewhere in inadequate initialization of hardware, not in Atmel Studio misconfiguration.

 

My sample program looks like this, where the infinite loop was stripped of all business logic, and was reduced to simple blinking for visual feedback.

sysclk_init();
board_init();
wdt_disable();
cpu_irq_disable();
irq_initialize_vectors();
cpu_irq_enable();
flashc_set_bus_freq(sysclk_get_cpu_hz());

udc_start(); // this line seems to the "root of all evil"

while (1)
{ 
    // blink a LED indicator so I could see the program is working
}

The call to udc_start() leads to the application hanging after power reset. Without udc_start() the application keeps blinking forever and is resilient to power resets.

 

The real application communicates with my PC using the USB connection, so I need to understand why udc_start() causes this problem. Perhaps I need to check whether the USB driver is already started, and only do udc_start() if it isn't? The documentation I have found so far doesn't have good examples. 

 

Any tips or suggestions? Thanks