G30 Battery RAM Access

Hi does anyone have a class for writing/reading to the battery backed up ram? Just trying to read/write a single 32bit integer. Not seeing anything in the data sheet or forums, other than to consult the underlying processor documentation (which clearly won’t have a prewritten class for me). Here are the addresses the ST data sheet lists. I don’t understand how to use them.

You can use the AddressSpace class to read the UID of a G30. Here’s an example of doing so (I think the actual address may not be correct, but the idea is there.)


Maybe you can use this class to do what you want as well.

So in the important call the first argument is the address cast as uint. Then the second argument is the buffer into which he is storing th e read which is a 12 byte array. Then he uses the last two arguments to say start from an offset of zero and read 12 bytes because he knows the UID is a 96 bit value.

Are you sure that is the same space as the backed up RAM? The device ID would exist even without battery back up so I think that is something different. I will be storing a cycle counter in the battery RAM that is written to EEPROM on power up so I need to be able to read/write it thousands of times (meaning configuration sector definitely won’t work either).

maybe this will work https://old.ghielectronics.com/community/codeshare/entry/725

@Gus_Issa Can you please explain to me how to access the G30 backup RAM? The underlying processor datasheet is unclear to me.

Why won’t the configuration sector work?

If I remember correctly, the configuration sector can only be written to once per flashed firmware.


Unfortunately, you’re in for a wild time trying to use this feature, is it isn’t enabled by default.

@Mr_John_Smith How does nobody have a prewritten class for this? cough GHI cough. What is the point of even noting that battery RAM is an option if its nearly impossible to find documentation on let alone make it work

For the real time clock, yes, for the registers that go with it; not so much.

Where did you see that?

I think the problem might be there is a limited number of times that the configuration sector can be written to since there is no reuse.

@Mike I thought someone from GHI told me but maybe conjured that bit up and mixed up the fact that I originally was looking to write only one time.

I’m pretty sure it’s NAND Flash meaning you should be able to write 100,000 times

No I am not sure about the address spaces. I never looked into it much for this chip. A simpler chip I used only had one space so everything could be mapped pretty easily. Was hoping it could be so simple :frowning: