I'm using a ATSAM4S device and I've encountered some problems. I've assembled two boards that are very similar(same pinout, same devices, just a change in LED GPIOs and MCU position on board). First one works very well, second one created me problems from start, like wrong ID, security bit set when it wasn't ecc. I've not used it for a while but now I need to use this board. Programming now working well(don't ask me how, I've switched to JTAG from SWD and this solved all problems also for switching back to SWD) but now, if I load the same code that is on the first, well working, board to this MCU, it goes random to HardFault in debug mode. Also when running simply code as LED blink, MCU resets at random after some seconds. Main cause of this problems is related to faulty MCU or PCB board(as after a lot of test I can't say that is a code error). So, since it's more probably that it's a PCB error, what can be the main problems that cause a MCU to reset randoms after some seconds?

p.s. I've tried same code on either MCU, changed to more stable power supply, tried simply codes, still have problems on this MCU.

  • \$\begingroup\$ In most of the cases on this site, it is missing decoupling \$\endgroup\$
    – PlasmaHH
    Feb 15 '16 at 10:22
  • \$\begingroup\$ Some times is leakage current due to bad isolation distance in the PCB. \$\endgroup\$
    – R Djorane
    Feb 15 '16 at 10:24
  • \$\begingroup\$ @PlasmaHH that's strange, the two boards have same decoupling placed in same way, maybe one cap is gone? \$\endgroup\$
    – Singe
    Feb 15 '16 at 10:28
  • \$\begingroup\$ @code how I can find where I've this leakage? \$\endgroup\$
    – Singe
    Feb 15 '16 at 10:28
  • \$\begingroup\$ Could be that the watchdog timer is causing the processor to reset. Do you disable/configure it correctly? \$\endgroup\$
    – Dean
    Feb 15 '16 at 10:50

1-It might be missing decoupling capacitors or their layout (far from uC) or their values. check out hardware design consideration ATmega

2- make sure the reset pin is pulled up correctly. Recommended reset connection

3- check out BOR , POR and Watchdog settings.


Not the answer you're looking for? Browse other questions tagged or ask your own question.