JAvrProg issue relating to bootloader

x0x0x0x0x0x

Moderators: altitude, adafruit_support_bill, adafruit, phono, hamburgers

Please be positive and constructive with your questions and comments.
bancos991
 
Posts: 10
Joined: Sun Jun 09, 2013 6:00 pm

JAvrProg issue relating to bootloader

Post by bancos991 »

I purchased a x0x a while back from an online retailer, and it's been great for music making. It does have some timing issues with some devices, so I looked into updating its firmware.

I'm using JAvrProg to load a new .hex firmware file. After installing the application correctly and the USB serial drivers, the application reports that it "Failed to find AVR board" despite accurately following the instructions in the ladyada bootloading guide. It detected the COM port the x0x was connected in too, and I can also successfully connect to it using c0ntr0l.

Upon switching to bootload mode on the x0x, an array of LED's light up, but not the entirety of them. After some research, I'm guessing that the bootloader has not been burnt on the micro-controller (and it can't find the AVR board), which is required before updating any existing firmware.

I don't really have any electronics experience (other than computer building) which is a problem too.

What are my options in this case, and how can I tell for sure that there is no bootloader (e.g. software glitch or communication issue)?

Thanks all :)

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

you can determine whether the bootloader is there or not by doing the following test:

1) set the MODE to point to BOOTLOAD
2) switch the x0x OFF
3) switch the x0x ON
4) set the MODE to any other mode (Random/Keyboard/PatternPlay)

- if the x0x actually switches to the given mode - that means that it was running the firmware, thus no bootloader
- if the x0x doesn't react - then it's stuck, thus probably it's running the bootloader

bancos991
 
Posts: 10
Joined: Sun Jun 09, 2013 6:00 pm

Re: JAvrProg issue relating to bootloader

Post by bancos991 »

Well in this case it seems to be stuck with a set of lights lit up as if it's still bootloading. If there is a bootloader then, why can't I access it? I've tried this application config across both XP and Vista.

EDIT: Just took a lot at your sig's proposed changes to the original c0ntr0l software:

"bugfix- non-working protection from too-large .hex files, making it possible
to erase the bootloader, ouch"

I did try and bootload from c0ntr0l using a 42.8KB v1.05 firmware .hex, but I'm not sure this file size is what you're referring to. It didn't recognise the x0x to begin with hence the bootloading never happened, so I then attempted to try JAvrProg.

Thanks again man

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

uh, you got me confused
what you quoted there about the bugfix - that's a bugfix for BANNED v1.00 vs v0.99
and that has nothing to do with c0ntr0l

c0ntr0l is the original x0xb0x control app, BANNED is an alternative written in a different language, from scratch

the size of the .hex file doesn't matter because the actual firmware data is encoded into text (thus it's much smaller) and needs parsing

so to clear the confusion: did you manage to get the x0x working now?

bancos991
 
Posts: 10
Joined: Sun Jun 09, 2013 6:00 pm

Re: JAvrProg issue relating to bootloader

Post by bancos991 »

Apologies for the confusion, I understand what you meant now. After following your instructions the x0xb0x seems to be 'stuck' indicating it may have a bootloader. However, I still get the same error, in that JAvrProg cannot find the AVR board when the x0xb0x is connected.

How should I progress from here?

Thanks

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

i've never used this javrprog thing, only c0ntr0l
i don't know how javrprog works
c0ntr0l for example, doesn't set the serial port settings, it just connects.. then the default settings are used (which can be set from the driver options, at least on windows, no idea about osx)

you could try to flash the hex with BANNED
BANNED sets all the needed port settings every time
the default settings should work right away (baudrate 19200) you just need to set the port name

bancos991
 
Posts: 10
Joined: Sun Jun 09, 2013 6:00 pm

Re: JAvrProg issue relating to bootloader

Post by bancos991 »

Well I tried the program and attempted to flash SoKKOS 1.9.1 .hex, and got an error message mentioning something along the lines of not being able to find the letter Z and asked to terminate. After this I disconnected safely and now it is bricked :x . It assumes it's in bootload mode regardless of which mode I boot it up with, and I cannot interact with it.

Originally, the firmware was adafruit v1.50. Why did this error occur exactly? I assumed that it checked for any issues prior to asking to continue the flash, which it did. I will probably now have to get hold of a new microprocessor chip.

After checking from the transparent back panel, it seems the chip is socketed, so I should be able to remove it and plug another in. How should I go about this process? What safety precautions should I take to ensure I don't wreck the internals?

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

:?
i get it now
the x0x was working initially, then you attempted to flash the hex with BANNED
BANNED detected that the bootloader is there and responding, then prepared to flash the hex

when you proceed from there, the actual process is:
1. set address to 0
2. send "e" command (to erase the chip)
3. send "a" command to ask if the bootloader supports autoincrement
4. send "P" command to tell the bootloader to prepare for Programming mode
5. send "Z" command with a packet of 128 bytes from the hex data

step 5 is repeated many times untill the whole hex data is sent

all of these commands require a specific reply from the bootloader, and if BANNED doesn't get the expected reply - you get a specific error message, respectively

in your case, you should have seen on the screen the progress in percent anywhere from 0 to 100% when this error occured
the actual error could be one of two:
1. "Error: no response to 'Z' message"
2. "Error: bad response to 'Z' message"

it would have been helpful if you remember which of the two was it

but anyway.. this surely means that if the process started but didn't finish - the firmware on the cpu is basically corrupted and won't work (as you say it acts like bricked)
however, in theory the bootloader shouldn't have been affected
so if that is really true (i hope so) then setting the MODE selector to BOOTLOAD and re-starting the x0xb0x should still start the bootloader, while setting the MODE to any other mode and re-starting would simply execute the firmware (which is surely corrupted)
you can try to flash firmware again, and see if the app gets any[/] kind of response from the bootloader - that would confirm that the bootloader is intact and you should be able to flash the firmware hopefully, try a shorter USB cable (if yours is too long) i'm just guessing here

otherwise, if the bootloader has been corrupted too - you will need a new chip (with bootloader) or someone who knows how to cure bricked avr chips

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

with all these weird issues lately, i'm really shocked and don't know what's going on
it's not just you, there were a few other people very recently who had similar trouble with this procedure

one thing that could be happening is.. the serial port getting some bytes incorrectly for some reason
this has happened many times when connected to the firmware and doing pattern backup/restore, and i have no idea why it happens

c0ntr0l more or less does the same initial tests (like BANNED) to confirm that it is "talking" to a x0xb0x and not some other avr device
that is, asks for cpu number (to see if it's atmega162) then asks for the special string (which is "x0xb0x1") then checks fuses and other things

that's probably the same for javrprog too (maybe except the x0xb0x1 string)
but it probably fails to get the expected reply even on the first command (where it asks for cpu number)

this can surely happen if the actual data over the serial port gets corrupted from time to time
but i'm clueless why it happens

i'll try to look for some other connection of any kind
please tell me what your OS is, what version, where does your x0xb0x originate from (specifically the cpu), what's the length of the usb cable you used
and anything additional that might be even remotely related.. i'll try to investigate

thanks

bancos991
 
Posts: 10
Joined: Sun Jun 09, 2013 6:00 pm

Re: JAvrProg issue relating to bootloader

Post by bancos991 »

Right. I've just managed to successfully start the flashing again after repeatedly getting Device ID connection errors. Here is what happened exactly:

1. Pressed key to continue flashing the 1.9.1 firmware
2. Reached 7% and generated the following error:

Code: Select all

Uploading firmware... 7% *WTF_WTF* ERR
          An error occurred.
          Error: no response to 'Z' message
          Press any key to continue...
you can try to flash firmware again, and see if the app gets any[/] kind of response from the bootloader - that would confirm that the bootloader is intact and you should be able to flash the firmware hopefully


I'm guessing here that my bootloader is intact, and the firmware is corrupted due to partial completion.


i'll try to look for some other connection of any kind
please tell me what your OS is, what version, where does your x0xb0x originate from (specifically the cpu), what's the length of the usb cable you used and anything additional that might be even remotely related.. i'll try to investigate


I'm looking at the connection stats just now. "??? unknown FW v1.05" I bought this a few years ago from x0x source I believe (unaware of the exact CPU origin, apologies), and my USB connection cable is approximately 123.5cm (EDIT)


Thank you again for your patience with this

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

okay, this is very good then

i meant what OS (on your computer) like windows or OSX and what version are you using
don't attempt to "Connect to x0xb0x" now, since that procedure is meant to be used with the firmware, not the bootloader (and it isn't a good idea to send random data to the bootloader)

my x0x originates from x0xsource as well so the issue is probably not related to that

okay, so, if you're on windows, i can rebuild a version of BANNED for you with some attempts to see if i can fix the issues
for osx it will be slower since i rely on another guy to compile the app there

bancos991
 
Posts: 10
Joined: Sun Jun 09, 2013 6:00 pm

Re: JAvrProg issue relating to bootloader

Post by bancos991 »

I'm currently running a Vista 64-bit OS. I have used "Connect to x0xb0x" but not performed any operations that may write data (only observation after the connection) so it should be fine. I did this same observation prior to my second bootload and it still located the bootloader.

Rebuilding a tweaked version would be fantastic, I would be very grateful. What exactly is the root cause of the error though? If it is a USB cable length hardware issue, then an application rebuild surely won't fix the problem.

EDIT: May not be of high importance, but I cannot shut the application down using the standard "red cross" or through quit. I have to force quit the application by killing it in task manager. Vista is pretty buggy and may not be totally compatible with it.

Thanks again.

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

"Connect to x0xb0x" does send data initially too, but more complicated messages (ping, get tempo, and other stuff)
those are encoded into fat messages with CRC and what not (usually 4 bytes or more per message)
the bootloader works with single byte messages, so when it sees such a packet of 4 bytes - it'll think it's 4 sepparate messages and will try to reply to them (or do actions)
like if one of the bytes happens to be "e" - that is the chip-erase command (which would erase the firmware sector)

now, i'm not really sure what causes these problems here, i am only guessing that it could be going corrupt when data is sent too quickly which itself could be happening due to the not "strong" enough data connection which i am suspecting

so i would first try to add little "pauses" (very short ones) between each byte to see if this would make the data go corrupt "less often"
if that happens to work - i would still not know what causes the issue, but at least you will be able to flash your hex

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

bancos991 wrote:EDIT: May not be of high importance, but I cannot shut the application down using the standard "red cross" or through quit. I have to force quit the application by killing it in task manager. Vista is pretty buggy and may not be totally compatible with it.
actually that's because the close button is not quite implemented
to exit the app you have to press quit or press ESC a bunch of times
at the main menu it might ask you to save the changes to the config file - press Y or N
at the very end, there is a silly animation, hit ESC again to close the app

this is a bit weird, i know :mrgreen:

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: JAvrProg issue relating to bootloader

Post by antto »

okay, recompiled
added a 1ms delay on each spWrite() call, that would make it send data slightly slower
http://antto.pwnz.org/tmp/BANNED.exe

if it reaches a higher progress before it gives an error - that could be a rough sign that this might work

Locked
Please be positive and constructive with your questions and comments.

Return to “General x0xing”