Custom Bootloader needed

Well sort of progress, i am now getting a message on the serial port

But it is just looping, and never leaving the bootloader its almost like it exits the bootloader and restarts the bootloader

Now that's a kind of success. Can you send some text or just to the bootloader? Or Try, if you could flash some program using "stk500" protocol? I am not sure if the program works at all, 'cause there is a 2s timeslot where it waits for bootloader commands over serial and then does "interesting" things - see stk500boot.c

interesting, if i send anything through the serial port during the booting, the messages and the LED stop and it just hangs until i reset it.

I am also not able to upload anything useing the STK500v2 protocol

If i upload my code using my AVR programmer it seems to overwrite the boot loader and boot directly into my code.

If i then re-flash the boot loader, my code never runs

Ok, there are ~ 1000 lines spacetticode and a strange variable "boot_state". It stays 2 sec. on "boot_state==0", then goes to "bootstat==1" with blinking led which it only ever leaves when it get the command "CMD_LEAVE_PROGMODE_ISP" (stk500 protocol or some command overserial (IMO it is "!\r\n"), then it goes to "boot_state==2" where it checks for EEPROM 0x1ff==0xff and then searches for firmware.bin on the sd-card and flashes it ... looks like one needs to do some code rework with a fine needle to get that working as intenden :slight_smile:

IMO if that's not ending in a commertial product I'd put that aside.

Could not leave it at that. I kicked all the stk500 stuff, so just the code for flashig from sd-card is left. To initialite flashing, you have to der EEPROM 0x1ff == 0xf0, the the led should flicker while flashing - at least that's what the code says. Let's see if it works in reality.

stk500boot_v2_mega2560.hex.zip (5.1 KB)

LOL your worse than me, i can never walk away from an issue, it is in my DNA to fix things. Thanks so much for your time on this. I will try this a little later today and let you know how i get on. Does it have any debug output ?

Yeah, kind of a gene defect :slight_smile:

IMO ther is no output but I could be wrong. There is just some code for flickering LED while accessing the sd-card.

Oh, it might be that the avr programmer disables the bootloader bits, so as long as it does not do a full chip erase you might just have to set the bootX bits again.

And have you tried?

Hello,

Sorry not getting back sooner.

Yes did try but still not coming out of the bootloader and running the sketch code.

I know that loading the bootloader using mi ICSP programmer is fine as i can load the default bootloader and everything works as expected.

Next i will try putting the custom bootloader onto a standard arduino mega then try uploading a sketch across the serial interface to see what happens.

Cheers Pete

And does the LED flicker or not?

Not consistently ; sometimes it is solid and sometimes flickers

Cheers Pete

OK so, I have been trying again,

It flickers twice on re-booting then goes solid. Nothing from the serial port other than “booting …”

This is frustrating

Cheers Pete

Flickering => bootloader accesses sd-card, solid = waiting for sd-card to answer. so it looks like this needs some more hours to figure out what's going on. But without an atmega2560 I'm afraid I cannot be a lot of help... If it's a commertial project then it might pay off to invest some hours, but I's estimate a good part of a week to get it going. Sorry.

I'm curious: Where are y'all with "funding"?
The initial $50 offer for "can someone recompile this code with slightly different options" seemed somewhere between "appropriate" and "generous." Perhaps an hour of download, understand, modify, compile, upload, communicate.
But it wouldn't have covered any serious debugging of code that just didn't work, or even a lot of iterations of "well, now try this" over various options...

Please dont be sorry, you have been a great help. Thank you for your time spent trying to resolve this.

If it turns into a commercial project then with your permission i will come back to you with an offer of payment to resolve this.

Cheers Pete

It turns out that the code was not in a good place and despite efforts to get it there without hardware to test on it become more than a few compiles and tests.

Cheers Pete

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.