Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Arduino in strange state

2 posters

Go down  Message [Page 1 of 1]

1Arduino in strange state Empty Arduino in strange state Mon Jan 18, 2021 5:53 pm

mvandorp



I am developing an application, where I store the settings in EEPROM. Fir these tests, I have a circuit of just an Arduino Mega in it.

The config blocks are 64 bytes in size. The first two blocks are special; the other blocks all represent the same object (as in C++ Object).

When I write the first two special blocks and the first standard block, al goes well.
For debugging purposes, I output the blocks as Key/Value pairs to the Serial Monitor.

I increase the number of standard blocks to write, and up to block 9 goes OK.
Halfway block 10 my output stops.

I stop the simulation and I write the EEPROM data to a file. When I examine the EEPROM data, I see all the expected info. Block 10 has been completely written to EEPROM. It is p[ossible I made a programming error, or I ran out of memory, or something. I haven't investigated that because of the following:

* When I stop the simulation and start it again, just 1 character is printed to the serial monitor
* When I load the eeprom with empty data, and start the simulation, It only outputs 1 char.
* When I reload the firmware, just 1 char is printed
* When I reload the firmware AND empty the EEPROM, only one char is printed
* When I delete the Mega, and place a new one, load firmware, then the program runs once, and freezes halfway the 10th block. Then I am stuck again to 1 char outputs

This behavior is consistent. Apparently the Arduino gets into a state which bricks it. Fortunately it is a virtual one  Rolling Eyes

I can provide you with the HEX file causing this behavior. Because of this freeze debugging is very difficult: I yet have to think of a way of doing it....

Marcel



Last edited by arcachofo on Fri Dec 24, 2021 3:21 am; edited 1 time in total (Reason for editing : Marked as solved (green color))

2Arduino in strange state Empty Re: Arduino in strange state Mon Jan 18, 2021 9:52 pm

arcachofo

arcachofo

It is important to know which version are you using.

I can provide you with the HEX file causing this behavior. Because of this freeze debugging is very difficult: I yet have to think of a way of doing it....
That would be the best way for me to test it.
If i create my own test, the problem might appear or not.

Anyway i will have a look.

3Arduino in strange state Empty Re: Arduino in strange state Tue Jan 19, 2021 7:20 am

mvandorp



arcachofo wrote:It is important to know which version are you using.

I can provide you with the HEX file causing this behavior. Because of this freeze debugging is very difficult: I yet have to think of a way of doing it....
That would be the best way for me to test it.
If i create my own test, the problem might appear or not.

Anyway i will have a look.

I am using 0.5.15.RC4, but I had this before with 0.4.14 as well. Only did the investigation with 0.5.15.RC4 though.

Hex file is added.
Attachments
Arduino in strange state AttachmentWiWoAlarm3.ino.hex.zip
You don't have permission to download attachments.
(9 Kb) Downloaded 1 times

arcachofo likes this post

4Arduino in strange state Empty Re: Arduino in strange state Tue Jan 19, 2021 11:11 am

mvandorp



FYI:

I found the error in my code (a text string was too long) which caused the lockup.

It does NOT explain why the simulator doesn't work any more, not even after restarting the simulator (as described in my initial post).

Regards,

Marcel

5Arduino in strange state Empty Re: Arduino in strange state Tue Jan 19, 2021 12:35 pm

arcachofo

arcachofo

I found the error in my code (a text string was too long) which caused the lockup.
That's a good clue, but what do you mean too long?
It exceeded the EEPROM size?

6Arduino in strange state Empty Re: Arduino in strange state Tue Jan 19, 2021 1:26 pm

mvandorp



arcachofo wrote:
I found the error in my code (a text string was too long) which caused the lockup.
That's a good clue, but what do you mean too long?
It exceeded the EEPROM size?

No, not by far! Only 10 blocks of 64 bytes = 640 bytes (out of 8192)
I am manipulating some strings, and when the source string exceeds 8 characters, this behavior happens. I do have a length check in place, but apparently I do something wrong (I am an amateur programmer). When the source string is shorter, the code works as expected.

And yes, I am aware of the /0 at the end of a string.

I'm trying to pinpoint where exactly things go wrong. I keep you informed.

Marcel

7Arduino in strange state Empty Re: Arduino in strange state Tue Jan 19, 2021 10:26 pm

arcachofo

arcachofo

I am manipulating some strings, and when the source string exceeds 8 characters, this behavior happens.
So the problem appears at block 10 because there is an string > 8 characters?
If you use that string at lets say block 5 then problem appears there?

Ovbiously there is a problem in simulide, it should not "brick" whatever you do with it.
But Knowing the source of the problem will lead us to the solution.

Anyway I'm in the middle of some important changes in simulide code, and it is dificult to get into this right now.
Hopefully I can do some tests when i get the debugger running properly.

8Arduino in strange state Empty Re: Arduino in strange state Wed Jan 20, 2021 2:12 am

arcachofo

arcachofo

Finally the problem has nothing to do with EEPROM.

Arduino Mega is crashing trying to write to an invalid RAM address.

The problem in Simulide side was handling the crash incorrectly.

9Arduino in strange state Empty Re: Arduino in strange state Wed Jan 20, 2021 2:25 am

arcachofo

arcachofo

The "bricked Arduino" after crash should be solved in rev 45.

Currently the Arduino just stops working.
I will add some message for the user to know what is happening.

10Arduino in strange state Empty Re: Arduino in strange state Wed Jan 20, 2021 3:35 am

arcachofo

arcachofo

Added Warning message and animation showing which MCU is to blame (rev 46).


11Arduino in strange state Empty Re: Arduino in strange state Wed Jan 20, 2021 1:33 pm

arcachofo

arcachofo

And...

There is a basic EEPROM viewer for MCUs coming.
Just the bare bones but is much better that having nothing.
Very useful for EEPROM stuff debugging:


Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum