You need to log in to create posts and topics.

(Windows 10) 0xC0000005 (segmentation fault) in Simulide 1.1.0-SR1 when using timer 0 of atmega128

I started learning about atmega128 and was using this simulator, wich btw is pretty cool, to use it without having to buy one, and all other things, like resistors and wires.

well, everything was fine until i started using timer 0, wich i started learning some days ago. when i set the value of TCCR0, depending on the value i put in it, it will crash. the thing is, its always in the same offset, wich is 0xA94CBF. im using the precompiled latest version, 1.1.0-SR1, as said in the title.

for now, im using assembly, so in case you dont have the assembler im using, wich is avrasm2, i left hex files with the 3 cases of the crash, wich are setting the 4th, 7th or both bits as 1 in TCCR0. i also tested with TCCR2, and it seems it has the same issue, but im not sure, i just tried TCCR2 with the same value i was using in my original code, wich had 4th bit as 1

cuz of the way it crashes (takes some us (lowered time to 1 us to see)), and the way its always in the same offset of the program, then i assume its probably some faulty configuration on one of the atmega128 files, related to timers (at least 0)

 

this can also be just lack of skill from me, maybe some mode must be set before using those registers, and cuz it expects them to be on and they arent, it crashes. idk, please tell me

it didnt want to send the zip
https://www.mediafire.com/file/0yh0vfqxrg14953/atmega128_timer_crash.zip/file

Hi.

You are spot on: the problem is in some of the configuration files.
To fix it, replace simulide/data/AVR/mega64_128 with the content of the zip attached to this post.

If it doesn't work please let me know.

Thanks for reporting and the explanations and files.

Uploaded files:
average_simulide_enjoyer has reacted to this post.
average_simulide_enjoyer

after re-testing, i confirm it works for timer 0. however, timer 2 seems to actually have an issue too, like i theorised
i tried the same in the file data\AVR\mega64_128\mega64_perif.xml, of setting, in line 56, the name to OC2A, instead of OC2, and it didnt crash, but im not sure it needs extra work.

and a minor thing: in this same file, in line 27, theres a comment: "<!-- timer0-2 8 bit, 1-2 16bit -->"
i assume it should be "<!-- timer0-2 8 bit, 1-3 16bit -->"

Thank you, I didn't see the OC2 issue.
Anyhow I also fixed it in the source code, so it will accept OC2 or OC2A if there is only one OC unit.

About that comment, you are right, but I just deleted it, it is not needed.