Hello. I need to different type of reboot on my firmware, but unfortunately i can't use watchdog...
So I choose ILOP and ILAD but I seems to be the same flag (ILOP of SRS register), could you please comfirm or invalidate this apsect ?
Thanks a lot !
vcz,
The STS register has separate bits for ILOP and ILAD. ILOP is bit D4 and ILAD is bit D3 in the SRS.
You can generate an illegal instruction in C using inline assembly with:
asm(dbc $8d);
You can generate an invalid address by creating a pointer, setting it to an invalid memory address and then writing to that address.
After that the micrcontroller will reset and in your startup code, you can read the SRS to see if you got an ILOP, ILAD or other reset cause.
Hope this helps,
Alan
Hello and thanks for your answer.
Unfortunatly, I'm using mc9s08aw16 MCU and bit 3 of SRS register is empty, according to the datasheet...
Moreover I'm using SDCC as compiler, so "asm(dbc $8d);" does not works, but this is not the problem I know how to make SDCC generate ILOP and ILAD.
No, the real problem is that ILAD and ILOP seems to be the same flag in SRS register...
Indeed when the MCU reboot after ILOP or ILAD, ILOP flag is 1 for the both. When I electically reset the MCU, ILOP flag is 0. So I cannot make difference between ILOP and ILAD.
Best regards
After many tests on the subject, ILAD flag is not available on the mc9s08aw16 MCU...
So I did what I had to do with watchdog reboot !
Hello,
Yes, you are correct, ILAD is not available as a reset source for the 9S08AWxx devices. The reason for this is that the 9S08AW60 does not have an unavailable address within its memory map. Since the 9S08AW16 is based on the larger device, it also does not offer illegal address detection.
Regards,
Mac