My fellow AVRFreaks,
- Atmel Studio 7.0.2397
- GCC Toolchain shipped with AS
- Windows 10 1909 x64
While debugging some ATmega328PB code in the simulator i noticed two issues:
- Register PCMSK3 in the I/O view (EXTINT) is always shown the have a value of 0x00 although a different value was written to it and is also correctly read back by my code.
I have not checked if the the other PCMSK registers have the same issue ...
- Executing a SLEEP instruction (sleep mode idle) seems to permanently hang the simulator and so the whole AS!
"Break All" as well as "Stop Debugging" have no effect, when trying to close the AS window eventually a dialog pops up saying some operation takes very long and is blocking user input, asks if i want to shut down AS anyway, but selecting yes has no effect.
Only killing the AS process in task manager works.
There seems to be and endless loop in the simulator (or somewhere else in AS) as the AS process causes 100% load on one CPU core when it hangs.
BTW there are two timer interrupts that should eventually fire while the AVR is sleeping and there is a SEI instruction immediately before the SLEEP!
I also noticed that when i single step (F10) through my C code and hit the SLEEP, AS does not hang but i can single step for ever without any progress in execution, so program counter, cycle counter and stop watch in the Processor Status view do not change at all. When i then continue execution (F5) or change into disassembly view and execute the SLEEP (F10 or F11), AS hangs the same way as described above.
Has anyone else seen this issues?
Does anyone know if Microchip is aware of them? Will they fix them?
Your can find the code and AS project to demonstrate the SLEEP issue here: https://github.com/bmildner/SimpleTaskSwitcher/tree/AS_SLEEP_issue/Test_ATMEGA328PB
The sleep_cpu() is in Switcher.c line 718.