Hello.
I have CC2430 MCU, but i assume that my question is more general.
I'd like to save some data in non-volatile registers.
What in datasheet should i look for in order to find General Purpose registers that keep their value after power-off.
Thanks for the answer.
Yes i work with Zigbee.
I have a problem and maybe you can help me out with this.
I need to poll data from external chip (that measures power consumption) every 30 seconds (Because i dont want for example to miss an activation of a kettle).
I'm afraid to write to MCU's flash in such high rate because it wouldnt last so long in this case.
You're wanting something that keeps its value with no power. By definition, "non volitile" memory. Check your data sheets on the processor you use and see if it has flash momory that can be written to by your program. This is non volitile. I know PICS use internal flash for executable code, but not sure if you can save (write) data to flash from your executing program. I do this but I am using Renesas processors.
Looks like you might want battery backup ram.
Then again writing a few bytes to a 1 gig flash at incrementing addresses once every 30 seconds would be *quite* a time span and would provide a convienient history as well.
Thank you.
Say that i have the option to detect the power dropping, how do i know that I have enough time to write to flash before the UC stop functioning?
Flash write takes 20uSec, but But i need to write about ~30 words (flash is word-addressable for writing) before power-down.
I am a software guy so this is on the fringe of what I know.
How much time you have depends on your system including the PS.
The CC2430 requires 2.0V-3.6V. That only leaves a volt and a half to play with. You could monitor the input voltage to the regulator, and have more time prior to VDD going too low for the chip to function.
I am thinking the first thing you would want to do is turn off the TX RX and any other hardware that uses a lot of current.
A capacitor would slow the voltage drop.
There are two ways you could detect the voltage drop. One would be to use an external comparator and have it alert the process via an interrupt line. Or use the onboard ADC to measure the voltage.
Once you have either of these you can output pulses after detection and count them to see how long between detection and failure.
I'm worried about saving data into non volatile memory every 30 sec, because it will get wasted after short time.
3V0.
I can try it, but it seems to unreasonable that in such a short time i'll be able to turn off all power consumers GPIOs and peripherals and write to flash.
It seems unacheivable.
I'm worried about saving data into non volatile memory every 30 sec, because it will get wasted after short time.
3V0.
I can try it, but it seems to unreasonable that in such a short time i'll be able to turn off all power consumers GPIOs and peripherals and write to flash.
It seems unacheivable.
The rate at which the power drops is slow compared to how fast the uC runs. You only need 600uS to write your data. I am not sure what devices it pays to turn off. You have to check the datasheet and experiment with that.
Could you tell me please how do i read from flash?
They explain there how to write, but how do i read a specific address from flash memory?
I write in C and dont know what command to use.
You mean that if i want to write to lets say 1KB of flash, then i need to allocate an array of 1KB size and have it mapped to the flash 1KB memory space that i want to write to?
Could you please explain about "make sure the compiler puts it into flash"?
You mean that if i want to write to lets say 1KB of flash, then i need to allocate an array of 1KB size and have it mapped to the flash 1KB memory space that i want to write to?
Could you please explain about "make sure the compiler puts it into flash"?
I do not know you compiler or chip, but I think you have it. If you use the const modifer there is a very good chance the array will be located in flash (this is compiler dependant). It is easier to let the compiler/linker figure out where to place the array. You could use the linker to setup a specific location in flash but do not fuss with that yet.
If you provide a link to you compiler docs I will take a look and see if I can find more info.