Go Down

Topic: How many times the RESET BUTTON has been pressed. (Read 163 times) previous topic - next topic

mariohdarin

I need to count how many times the RESET button has been pressed to replace the asm volatile ( "jmp 0"; ) function. Storing the variable in the EEPROM is a partial solution because it decreases the useful life for a time count of 1sec and even then, I have a loss of 1sec and decrease the useful life of the memory since I am doing time writing.
According to the datasheet in 15.6 Watchdog System Reset if I do, for example a "++ EEPROM.update [1];" before the time-out. (not funcional)
It could have an RSTCOUNT function like RSTDISBL, does not it?
I did not go deep, but I do not think I'll find anything on the modules pages of the AVR libraries, but I leave the link to some good soul to help me!
Does anyone have any ideas? Please! Do not suggest modifying the firmware or changing the microcontroller, etc. The challenge is launched and I thank you in advance.

I'm sorry for English, because I speak Portuguese and the one who helped me was translate.goo.gl.

larryd

Quote
The challenge is launched and I thank you in advance.
You are challenging us? :o
Isn't this your task.


No technical PMs.
The last thing you did is where you should start looking.

mryazdani

Hi,

If I were you and I couldn't find any solution, I would try this. You can connect your microcontroller reset pin to a RTC. Some RTCs can log the reset time and each time you can read the last reset time.

DrAzzy

#3
Jan 12, 2018, 09:18 pm Last Edit: Jan 12, 2018, 09:19 pm by DrAzzy
I can't think of anyway to do this with reasonable hardware and firmware mods, let alone without!

The big issues: everything gets reset by reset button, I don't think you can tell whether a reset was reset button, POR or BOD reset, and I think the bootloader destroys the evidence of a WDT reset.

Worse still, the mechanism used to reset the chip to upload a new sketch or when the serial monitor is opened is by pulsing the reset line low, so that looks just like a button press.

updating eeprom is easy - obly update when it changes and you can count up to a million resets before jitting the endurance limit. That is of course assuming you have a way to detect the kind of resets you wish to count. That's the hard part.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

pert

for a time count of 1sec and even then, I have a loss of 1sec
I don't understand what this means. Are you resetting once a second or are you talking about the bootloader delay?

mariohdarin

You are challenging us? :o
Isn't this your task.

Desculpe se me expressei mal Larry, minha intenção era dizer que o meu problema foi exposto e ficarei grato se alguém puder me ajudar!

Sei que não é minha tarefa desafiar a comunidade deste fórum, mesmo porque, como sou novo aqui, devo me por no meu lugar.!

Para evitar reincidência, usarei minha língua nativa (não li nada nas regras sobre restrição de linguagem, a não ser ofensiva! Rsrs)

Hi,

If I were you and I couldn't find any solution, I would try this. You can connect your microcontroller reset pin to a RTC. Some RTCs can log the reset time and each time you can read the last reset time.
RTCs são realmente ótimos e obrigado pela dica mryazdani, mas o hardware deve ser o mínimo possível neste projeto. Se for o caso (último recurso), farei algo com capacitor e transistor.

I can't think of anyway to do this with reasonable hardware and firmware mods, let alone without!

The big issues: everything gets reset by reset button, I don't think you can tell whether a reset was reset button, POR or BOD reset, and I think the bootloader destroys the evidence of a WDT reset.

Worse still, the mechanism used to reset the chip to upload a new sketch or when the serial monitor is opened is by pulsing the reset line low, so that looks just like a button press.

updating eeprom is easy - obly update when it changes and you can count up to a million resets before jitting the endurance limit. That is of course assuming you have a way to detect the kind of resets you wish to count. That's the hard part.
Realmente Dr Azzy, estou com um problema que foge dos padrões. Procuro soluções mas não tenho muitos conhecimentos na programação de baixo nível para compilar um novo firmware e nada encontrei com tal modificação. Talvez estudar Assembly será minha nova meta de aprendizagem. Como tem uma grande atividade em microcontroladores, o que sugere?

I don't understand what this means. Are you resetting once a second or are you talking about the bootloader delay?
Pert, relendo o post realmente ficou fora de contexto. Foi apenas uma ideia maluca de registrar uma contagem na EEPROM e quando apertar o reset reiniciar a contagem, e então, saber que o botão foi pressionado (mas totalmente inviável por vários motivos, os mais óbvios é o desgaste, já comentado e que a contagem também contaria para o desligamento do Hardware).

É isso pessoal, aceito sugestões.

Se chegarmos em algo novo, acredito que muitos serão beneficiado pelo recurso. Vejo algumas entre muitras formas de uso.



pert

You forgot to translate. Also, did you know there is a Portuguese language forum section:
http://forum.arduino.cc/index.php?board=35.0

Regarding wear, if you did wear leveling the EEPROM will likely outlast the button.

Go Up