David Brown a écrit : > On 22/06/2021 18:00, Ian Molton wrote: >> On 22/06/2021 12:59, BERTRAND Joël wrote: >>> Hello, >>> >>> I'm writing a firmware for a board that uses a ATMega 1284. Firmware >>> continuously restarts >> >> This is likely a branch through zero. >> >> Common causes on AVR are bad function pointers, and stack damage. >> > > A good way to check this is to track the reset cause. At startup, look > for the reset cause (and print it out on debugging, record it in logs, > or whatever is appropriate for the system), then clear the reset cause > flags. If you find you are starting up and there are no reset cause > flags set, then you haven't actually reset - you've just jumped to > address 0. > >
MCUSR=02 (after external reset) ================= Systella L100-A ================= Booting firmware 2021062218 SPI initialized Reset LORA Reset LORA done LoRaWAN 1.1 Initialization SX1262 Initialization SX1262 done 0004A30B0013F046 MAC initialization LDL_MAC_addChannel:786>chIndex=0 freq=868100000 minRate=0 maxRate=5 LDL_MAC_addChannel:786>chIndex=1 freq=868300000 minRate=0 maxRate=5 LDL_MAC_addChannel:786>chIndex=2 freq=868500000 minRate=0 maxRate=5 cb type=11 processInit:990>set radio reset: ticks=126 processRadioReset:1005>clear radio reset: ticks=126 MAC initialization done lora_send processStartRadioForEntropy:1057>listen for entropy: ticks=127 processEntropy:1074>read entropy: ticks=127 entropy=1385813498 cb type=0 LDL_MAC_ready LDL_MAC_otaa LDL_MAC_addChannel:786>chIndex=0 freq=868100000 minRate=0 maxRate=5 LDL_MAC_addChannel:786>chIndex=1 freq=868300000 minRate=0 maxRate=5 LDL_MAC_addChannel:786>chIndex=2 freq=868500000 minRate=0 maxRate=5 MCUSR=00 ================= Systella L100-A ================= Booting firmware 2021062218 SPI initialized ... RESET flags are always 0 when firmwware restarts...