Page 3 of 4

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 4:10 pm
by ry755
immortalx wrote: Fri Dec 29, 2017 8:37 am Guys, you can't believe how thankful I am! IT WORKS!!!!!!!! ry755 extra thanks to you man, for suggesting to burn the bootloader with the chip onboard! It worked first time and without a hitch!
The only think I omitted was to mess with the lock bits after burning the bootloader. I guess I have to be careful not to put any games > 61440Kb.

Again thank you all from the bottom of my heart!
Glad to hear you got it working! :D I’m also curious about what happened in the first place. Maybe when the bootloader was originally flashed there was an error while writing? That shouldn’t happen though as avrdude verifies everything after writing.

Jubatian wrote a new bootloader with better error checking and FAT32 support. I don’t know if it’s been tested on an Euzebox, but it should work. See here: viewtopic.php?f=3&t=9405

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 4:48 pm
by immortalx
@Jubatian thanks again!
From what I recall, when I first booted the Uzebox (without an SD inside) I saw the "sd init failed message and Megatris wasn't installed either.
I then formatted an SD card, put only arkanoid inside and rebooted with the SD card. The game launched right away. From then on, no matter if I held a button on the controller while resetting, the game restarted automatically. That's when I realized that the bootloader was someway overwritten.
Here's the strange thing: My son got all the games in his Linux setup by downloading the whole repo. The compiled and converted Arkanoid .uze is 56K.
I, on the other hand, have downloaded on Windows (from a thread somewhere here) a whole set of folders with the games already in .uze format.
My version of Arkanoid is 61532 bytes (size) and 65536 (size on disk) respectively. The problem is I can't recall which of the two we put on the SD card, but I believe it has to be the second which exceeds the 61440 limit.

I also downloaded the burn-in-tester but this one too has a size of 65536. Begore I proceed, shouldn't that overwrite the bootloader on my uzebox?
I haven't set any lock bits after burning the bootloader, in fear that I won't be able to recover it.
So before I proceed, my current observations are that indeed I get randomly failed games. To be more clear, games that I tested and worked perfectly, begin to crash on a new set of <format SD-->put a bunch of games-->reboot uzebox>.

@ry755 Thanks man! I saw the new bootloader but i hesitated to burn that one since, as you said, I don't know if it is compatible with the euzebox.

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 5:09 pm
by Jubatian
immortalx wrote: Fri Dec 29, 2017 4:48 pmMy version of Arkanoid is 61532 bytes (size) and 65536 (size on disk) respectively. The problem is I can't recall which of the two we put on the SD card, but I believe it has to be the second which exceeds the 61440 limit.
That doesn't exceed the limit: The .uze file has a 512 byte header which isn't loaded into the flash. So the limit is 512 + 61440 = 61952 bytes. Actually within that 512 byte header there is a size field which the bootloader uses to determine the game size, so in theory the .uze file might even have additional data beyond the game (although no game so far used such a technique). The "size on disk" field is irrelevant, it only lists how much space it occupies on the disk which is larger due to filesystem constraints (for example if you have a cluster size of 8 KBytes on a FAT filesystem, then every file would occupy a multiple of 8K no matter their actual size). The burn-in tester's .uze is 61952 bytes to test the complete 60K available for the game (it tests its integrity by reading the whole flash area it occupies and comparing it to a 32 bit CRC).
immortalx wrote: Fri Dec 29, 2017 4:48 pmSo before I proceed, my current observations are that indeed I get randomly failed games. To be more clear, games that I tested and worked perfectly, begin to crash on a new set of <format SD-->put a bunch of games-->reboot uzebox>.
Then my best guess would be that you ended up corrupting the bootloader by a fault happening when reading the header of the .uze file, causing it programming incorrect amount of bytes (by this, ending up overriding the loader itself to some extent, somehow ending up in such a corrupted state which caused it eventually jumping to address zero to start the game).
immortalx wrote: Fri Dec 29, 2017 4:48 pm@ry755 Thanks man! I saw the new bootloader but i hesitated to burn that one since, as you said, I don't know if it is compatible with the euzebox.
It works. I have an E-Uzebox which has the new bootloader on it. It should be compatible with all Uzebox versions which are capable to use the 0.4.5 bootloader. By the way it is already in the master repo as well (named "Bootloader5" in the demos directory).

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 6:03 pm
by immortalx
That was a very helpful and detail insight Jubatian, thank you very much!
I'm going to try the burn-in tester and new bootloader soon and will report back my findings.

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 9:17 pm
by immortalx
After trying the burn-in-tester it found an error on the COND test (7th bit turned red), but I could not reproduce it every time!

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 10:16 pm
by D3thAdd3r
Jubatian wrote: Fri Dec 29, 2017 5:09 pm Then my best guess would be that you ended up corrupting the bootloader by a fault happening when reading the header of the .uze file, causing it programming incorrect amount of bytes (by this, ending up overriding the loader itself to some extent, somehow ending up in such a corrupted state which caused it eventually jumping to address zero to start the game).
In your new bootloader is this something checked for before programming happens? It seems that is a pretty critical safety feature, as you well know, we have had many people in the past have had various intermittent reading errors(mostly I still attribute to soldering on PCB or sketchy breadboard wiring).

@immortalx glad your machine is back to life!
immortalx wrote: Fri Dec 29, 2017 4:48 pm I don't know if it is compatible with the euzebox.
More or less, the E/Uzebox is a standard Uzebox without the AD725 analog part(and supporting caps), same DAC principle, frequencies and all that. A few analog components are a bit different if I recall, but digital/logically it is identical. Basically if anyone says anything about Uzebox it is exactly true for E/Uzebox unless it is related to NTSC particulars(which the newer PAL SCART televisions mostly deal with NTSC in the same way, as I understand it).
immortalx wrote: Fri Dec 29, 2017 9:17 pm After trying the burn-in-tester it found an error on the COND test (7th bit turned red), but I could not reproduce it every time!
That is a little spooky, possibly an overclocking issue? Hopefully it is not, since the only fix to an overclocking issue is more voltage.

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Fri Dec 29, 2017 10:17 pm
by Jubatian
immortalx wrote: Fri Dec 29, 2017 9:17 pm After trying the burn-in-tester it found an error on the COND test (7th bit turned red), but I could not reproduce it every time!
Try to run it for longer periods, trying to figure out when that problem arises.

That 7th box of the COND test indicates a failure in a CPSE instruction: that is, CPSE produces an incorrect evaluation of equality (either skipping when the parameters are not equal, or not skipping when equal). So the ATMega you have seemingly doesn't like being overclocked.

If it only happens on power-up, it might be a power stabilization issue, fusing the ATMega to use the brownout detector at 4.5 volts might help (delaying the power-up until there is sufficient voltage). There are also fuses to add some milliseconds of start-up time for the oscillator.

Also keep in mind that if the burn-in tester repeatedly restarts on the CRC row after a short while, that means the flash contents are corrupt, this case any other red block is irrelevant (so if you were getting a COND fault in such a run, then that COND fault is irrelevant) as the fault could be anywhere (even within other tests).

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Sat Dec 30, 2017 7:35 am
by immortalx
Thanks again guys for the valuable info!
OK, after playing some games I left it running for a good 5 or so minutes and I can't re-produce that error. All boxes are green and a plus symbol scrolls continuously to the left of the tests' descriptions. All seems well now.
I also burned the new bootloader and it worked right away! I noticed that the flicker on the loading progress bar is gone. I could only have the bootloader read the contents of the SD in FAT16. When formatted to FAT32 it recognized the card but wouldn't display the games list. I guess my card is the culprit here. It's a "Silicon Power" branded 2GB. I'll try to get hold on another one and try it with FAT32.

I forgot to mention that the the chip is an 644P, if that is of any concern.

P.S. Sorry if my English seems a bit funky. Not a native speaker here :mrgreen:

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Sat Dec 30, 2017 8:11 am
by Jubatian
immortalx wrote: Sat Dec 30, 2017 7:35 am Thanks again guys for the valuable info!
OK, after playing some games I left it running for a good 5 or so minutes and I can't re-produce that error. All boxes are green and a plus symbol scrolls continuously to the left of the tests' descriptions. All seems well now.
I also burned the new bootloader and it worked right away! I noticed that the flicker on the loading progress bar is gone. I could only have the bootloader read the contents of the SD in FAT16. When formatted to FAT32 it recognized the card but wouldn't display the games list. I guess my card is the culprit here. It's a "Silicon Power" branded 2GB. I'll try to get hold on another one and try it with FAT32.

I forgot to mention that the the chip is an 644P, if that is of any concern.

P.S. Sorry if my English seems a bit funky. Not a native speaker here :mrgreen:
Great!

When formatting the card to FAT32 what are you getting? Empty SD Card? That would mean somehow either the root directory is empty, or maybe the FAT32 filesystem is not the first partition. There is no reason to format that card to FAT32 by the way, this capability is mostly intended for larger than 2GB SDHC cards. If the card worked with the old bootloader, just keep it FAT16 so games using the card keep working with it (those are only able to use SDSC with FAT16 filesystem).

The ATMega644P should be OK (I also have that in my E-Uzebox, works fine).

Re: Weird Euzebox issue: starts, but no bootloader

Posted: Sat Dec 30, 2017 9:56 am
by immortalx
I kept it at FAT16 as you suggested and it works each and everytime without a problem.
I can't thank you and all the other members of the community enough!
My son just did the hello world example and it was like magic seeing those characters on the screen! Couldn't be more exited, it was like the first time I booted my Spectrum +2 and saw the menu screen!