Read or write value from a sub-register

Hello, I’m trying to read a sub-register but it seems like I don’t do the right way.
It’s the THR_64 that I’m trying to read.
When I read at the address given with the code below, I get values ​​that change while this value is supposed to be fixed.
uint32_t value = (dwt_read32bitoffsetreg(0x03,0x18)>> 9) & 0x3F;

Someone could help me please ?

Bits 31-16 aren’t shown, they aren’t even listed as reserved, but you are trying to read them. I could see that acusin issues.
Maybe try reading 16 bits from that address. Or if for some reason you can only perform 32 bit reads then 32 bits from address 0x16 and right shift by16+9.
When writing those values definitely only write 16 bits.

1 Like

Thanks for your replie.
I don’t have problem to read 16 bits.
I’ve try this: uint16_t value = (dwt_read16bitoffsetreg(0x03,0x18)>> 9) & 0x003F;
But it’s always the same problem.
Thanks you.