Control Reset

hi,
is it some function that informs to me if the module is resetting or if the supply voltage is being lowered?
Regards

Are “you” an external device, or an Open-AT application?

You can use the battery monitor AT Command for that…

use the adl_adc channel 0 for that, don’t mess about with at commands :stuck_out_tongue:

adl_adcAnalogRead    (0, &AdcValuemV );

hi,
in an Open-AT application,if the module is resetting i must store in flash.
I store data in flash every 10s, if the module reset I want to continue to store from where it has been interrupted, controlling the id of the flash occupied not always I succeed to make it.example:

start application,
aspect that store until the id = 38
press reset
at the start application control till that id I have store, and returns id = 38 up to here… all ok!
continuous to store until all’ id = 60
press reset
to the successive start of the application goes to control of new till that id I have store, but instead returning id = 60, I obtain of new id = 38!
thus I have loss of data…

I hope of being be clear :slight_smile:
Regards

What, exactly, does that do?

If that directly asserts the hardware reset line - then there is no way that the software can know.
It would be the same on any other microcontroller!

What, exactly, are you trying to achieve here?

press reset = button reset on development kit q26
I must store data that arrive to me to gps ricevire, every 10s I storethe position, if the module had to be reset loses some relative data to the position.

TRACE (( LEVEL_TRACE_MAIN, __DATE__ ));
    TRACE (( LEVEL_TRACE_MAIN, __TIME__ ));

    int id_flash = 0;
    int len_pos = 0;
    timer_2 = adl_tmrSubscribe(TRUE, 10, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t)Tmr_DATA_Handler_2);

	Handle_Flah = adl_flhSubscribe ( (ascii *) Memo, (u16) 1500);
	TRACE (( 1, "Handle_Flah = %d",Handle_Flah));

	len_pos = adl_flhExist ((ascii*) Memo, id_flash );
	if (len_pos == 0) 
		id_pos_flash = id_flash; // After first reset id_pos_flash = 33, continue to store...after second reset id_pos_flash = 33 always...
                                                    // instead it would have to be greater
	else
		while (len_pos != 0){ 
			len_pos = adl_flhExist ((ascii*) Memo, id_flash );
			id_flash++;
			id_pos_flash  = id_flash;
		}
	TRACE((LEVEL_TRACE_MAIN,"ID  = %d",id_pos_flash ));

So that is a hardware reset.

Yes - that is pretty much unavoidable!

Think about it: if you press the reset button on your PC, you will lose any usaved data - won’t you?!

Therefore, you don’t press the reset button unless it is the absolute last resort, and there’s nothing else that can be done - and you accept that losing a little data is unavoidable.

ok, but why i lose data if i store in flash? why if i press reset the first time i don’t lose data?

Writing to flash takes a (relatively) long time - if the reset occurs during that time, data can be lost.

It is also possible that Open-AT buffers data in RAM before actually writing to Flash - which obviously gives you another window for data loss…

ok ,
it is a way in order to avoid to lose the data? what I do not understand, because after the first one reset does not get lost nothing?
Thanks
Regars

As already noted, the only way to ensure that you don’t lose data is to not press RESET unless the application is in a “safe” state to be reset.

Probably, that’s just pure luck: if the reset just happens to occur immeiately after a write has completed, then no data will be lost.
ie, you just happen to have been lucky and hit the window where the application just happens to be in a “safe” state to be reset.

As stated in the documentation, RESET should only be used in an emergency - when losing a little data is the least of your worries;
If you need some way for the user to be able to safely restart the application, then you need to provide some separate means to do that - which (among other things) ensures that all data is saved to flash before restarting.

Again, this is nothing specific to the Q26, Open-AT, or Wavecom - the same issues will arise on any system!

thanks 1000 for the information, I have understood that I must avoid to press the key reset:)