Hello,
I am trying to write in register WDOG_CNTL by the following:
1. Saving address of register WDOG_CNTL in register r3
2. Writing needed value "A6" in register r2
3. Storing r2 value inside address of r3
asm ("MOVS r2,#0x40"); /* 40 */
asm ("LSLS r3,r2,#24");
asm ("MOVS r2,#0");
asm ("MOVS r2,#0x05"); /* 05 */
asm ("LSLS r2,r2,#16");
asm ("ADD r3,r2,r3");
asm ("MOVS r2,#0");
asm ("MOVS r2,#0x20"); /* 20 */
asm ("LSLS r2,r2,#8");
asm ("ADD r3,r2,r3");
asm ("MOVS r2,#0");
asm ("MOVS r2,#0x03"); /* 03 */
asm ("ADD r3,r2,r3");
asm ("MOVS r2,#0");
asm("MOVS r2,#0xA6");
asm("STRH r2,[r3]");
At the last assembly line, assembler jumps to "Hard_Fault" exception.
Would you help please ?
Alright
thank you for your support
Hi,
I also tried to read this register through "LDR" instruction instead of "STR" and also it jumps to "Hard_Fault" exception.
Would you have any idea why the program also crashes with "Read" instruction.
This is only one byte - asm("LDRB r2,[r3]"); works fine.
I'm not sure what you are trying to do, but writting into CTRL and CTRH is used for WDOG reconfigure. More details you can find in reference manual - KEA64 Sub-Family Reference Manual, Rev. 2, July 2014 - page 218
Jiri
Hi,
the CNTL register is read only - that's why your your program crashes.
Jiri