Chat freely about anything...

User avatar
By donnib
#38441
torntrousers wrote:If you read the SDK Guide about the RTC read/write functions it mentions being 4 byte blocks -

"Note: RTC memory is 4 bytes aligned for read and write operations. Parameter src_addr means block number(4 bytes per block)."

I don't completely understand the implications of that, but if you change your
Code: Select allbyte r[1];
variable definition in your sketch to be
Code: Select allbyte r[1] __attribute__((aligned(4)));
it seems to fix it.


Wow, thank you very much, that did indeed solve the problem. I don't understand i did not have problem with the other variable. Also i have not seen this attribute before in any examples. Did not know it existed. :shock:
User avatar
By torntrousers
#38489
donnib wrote:
torntrousers wrote:If you read the SDK Guide about the RTC read/write functions it mentions being 4 byte blocks -

"Note: RTC memory is 4 bytes aligned for read and write operations. Parameter src_addr means block number(4 bytes per block)."

I don't completely understand the implications of that, but if you change your
Code: Select allbyte r[1];
variable definition in your sketch to be
Code: Select allbyte r[1] __attribute__((aligned(4)));
it seems to fix it.


Wow, thank you very much, that did indeed solve the problem. I don't understand i did not have problem with the other variable. Also i have not seen this attribute before in any examples. Did not know it existed. :shock:


I think its a bit odd too. I saw this in one example once but can't remember where now, but have used the RTC memory a bunch of times and its worked fine without the aligned attribute. I wonder if theres a bug somewhere in the RTC read/write functions and this is just bypassing that rather than the correct fix.