Read registers using C code?
Posted: Sun Apr 21, 2019 5:39 pm
Hello,
I would like to read back the key once I finished my crypto computation.
Do you know, please, how I can read back the value of the AES stored into the registers AES_KEY_0_REG ~ AES_KEY_3_REG (0x3ff01010-0x3ff0101C), once the set_key has been processed?
The reference manual shows Access R/W for these registers.
I have tried different code in arduino core such as:
Serial.print("K=");
for (int i = 0; i < 4; i++) {
char str[6];
keyreg= *((volatile uint32_t *) (0x3ff01010+0x4*i));
sprintf(str, "%04x", (int)keyreg);
Serial.print(str);
}
But no success. As I see is all 0. Did I make a mistake?
I have also tried REG_READ function defined into soc.h but not compilation fails...
If someone has a code example, it would be perfect, even if it is not for these specific registers.
Regards
sk
I would like to read back the key once I finished my crypto computation.
Do you know, please, how I can read back the value of the AES stored into the registers AES_KEY_0_REG ~ AES_KEY_3_REG (0x3ff01010-0x3ff0101C), once the set_key has been processed?
The reference manual shows Access R/W for these registers.
I have tried different code in arduino core such as:
Serial.print("K=");
for (int i = 0; i < 4; i++) {
char str[6];
keyreg= *((volatile uint32_t *) (0x3ff01010+0x4*i));
sprintf(str, "%04x", (int)keyreg);
Serial.print(str);
}
But no success. As I see is all 0. Did I make a mistake?
I have also tried REG_READ function defined into soc.h but not compilation fails...
If someone has a code example, it would be perfect, even if it is not for these specific registers.
Regards
sk