Is my bootloader faulty?
Moderators: altitude, adafruit_support_bill, adafruit, phono, hamburgers

Please be positive and constructive with your questions and comments.

Is my bootloader faulty?

by Oortone on Tue Dec 05, 2017 7:58 pm

I've trouble getting bootloader mode to work.

According to what I've read some leds are supposed to blink when starting in Booltloader mode.
Which ones?

When I start I mostly get no leds, sometimes I get all (or almost all) leds. This is less often.

x0xbox seems to be working otherwise.
USB communication with c0ntr0l seems to work but not firmware upgrade.

Since I don't know which OS is on the CPU I'm guessing the only option for me is to buy a new CPU with a modern OS?
Or could I initialize it somehow?

Posts: 2
Joined: Tue Dec 05, 2017 7:54 pm

Re: Is my bootloader faulty?

by Nordcore on Wed Dec 06, 2017 2:44 pm

No, the default Bootloader does NOT SET the LED properly. It leaves them in the (more or less) random(!) boot up state.

My bootloader changed that. But a new bootloader can only be programmed with a programmer (hardware device), so nobody has that.
The Bootloader of the x0xLarge also changes that. (See x0xLarge documentation if you have that. )


If your x0x is working OK in the other modes and shows a (more or less) random pattern if powered up in BOOTLOAD, and this does not change if you turn the mode knob, than it seems that the boot loader code is in fact OK! (= the boot loader inhibits the normal x0x program start successfully. )

Windows only:
Power up the x0x, connect it to your computer by USB and see if there is a "USB Serial Port (COMx)" (x=2..99) device in device manager. (see: https://www.drivereasy.com/knowledge/a- ... n-windows/ ) You need this number for setting up c0nb0x!
If you see this COMx port, than a)the FTDI chip inside your x0x works and b)your Windows has the proper drivers.
If you don't see it, you have to solve that first. There is absolutely no use messing around with c0nb0x if you don't have that COM display in the device manager.

Posts: 99
Joined: Sat May 23, 2015 3:14 pm

Re: Is my bootloader faulty?

by antto on Wed Dec 06, 2017 4:52 pm

as Nordcore said, the "normal" x0xb0x bootloader doesn't blink any LEDs

what you've read about blinking LEDs was probably about the x0xb00t2.x bootloader, which is available on the cpu-upgrade adapter (x0xlarge)
if your x0xb0x is a "normal" one, then you would have the original cpu (atmega162) and the normal bootloader, which doesn't initialize the LEDs at all, so they end up in a quasi-random state (some may be on, others off, or all could be on/off, but definately no blinking ones!)

so, in your situation (assuming that you are indeed running the normal cpu), check whether you have a working bootloader (because there have been circulating some badly programmed atmega162s with a firmware flashed on, but no bootloader at all)
..do this by turning the x0xb0x ON in "bootload" mode, and then turn the MODE/FUNC selector knob to any other mode (like pattern play, keyboard mode)
- if the x0xb0x responds to that (by changing the LEDs, responding to button presses, playing notes, etc) then it seems that you don't have a working bootloader
- if the x0xb0x doesn't respond to that, then chances are high that you have the bootloader working and waiting for commands

and just for your information, if you'd be buying a new cpu (atmega162) for some reason, buy it from one of the respected x0xb0x sellers, or ask the seller whether he's sure that the chip has a working x0xb0x bootloader on it, and not just a firmware

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

Re: Is my bootloader faulty?

by Oortone on Sat Dec 09, 2017 6:09 am

Thanks for the help. I can confirm it seems like my bootloader is ok, I did the test starting in bootloader and then turn to other mode and it doesn't change.

Thing is, I only have some Macs, no Windows.

So I have tried Virtual Box/Windows XP and since I can make c0ntr0l talk with the x0xbox in the other modes I'm pretty sure the COM-port and driver things are working properly. USB almost always work extremely well with VirtualBox I use it a lot.

I've also tried c0nb0x for MacOS with th X11 stuff but I can't manage to make it communicate properly although I managed to start the c0nb0x program and wander through it's options. But no proper contact with the machine.

At least now I know the situation. Since I'm not planning to experiment with different OS I guess I might buy the latest non-experimental one on chip so I know what's inside my box.

Is SokkOS 1.9.1 considered the latest stable (non beta) version? That's what these guys offer anyway:
https://sound-imperium.de/gb/electronic ... miert.html

Posts: 2
Joined: Tue Dec 05, 2017 7:54 pm

Re: Is my bootloader faulty?

by antto on Sat Dec 09, 2017 7:05 am

no, i wouldn't call sokkos 1.9.1 "latest" or even "stable"
there are, probably, bugs in all firmwares
in your situation i'd try at least sokkos 2
but that's still old, so go for MarOS (check the thread in this subforum)

what you really need is a manual, and there is no decent/complete manual that i know of for sokkos, but there might be for MarOS

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

Re: Is my bootloader faulty?

by tetrabrik on Mon Jun 25, 2018 12:13 pm

Hello x0xb0xers

I'm new here, and a perfect rookie regarding AVR programmation!
To summarize: I built a x0xb0x last month (see https://plus.google.com/u/0/collection/U1pGLF, post of the 25th of June). The analogue part is ok, except low signal from the headphone amp. Maybe the amp op LA... is not a good part, I have to investigate but it is not serious.
However: I have troubles with bootloading the ATmega162. I bought it blank in an elctronic components supplier, since there is apparently no more supplier of pre-burnt AVR for x0x.
Thus, I tried via the UART plug/FTDI converter inside the x0x. I carried out the methodology as described in http://www.ladyada.net/wiki/x0x/bootloader, using CommAPi etc.
Unfortunately, this method works with Windows x32 (more than 10 years ago?) and my PC OS is W7 x64. There are troubles with drivers while running CommAPI. Thus forget it, it appears to be "obsolete". I can specify that I soldered the FTDI microship, and the PC downloaded automatically the driver, attributing a new COM port. It is ok, but this bootloading route is not "direct".
With Arduino, you can find forums but it is confusing. i tried by adding the ATmega162 in the "Boards" file, then Pin assigment and Optiboot files. I plugged the x0x, IDE recognized the serial port, I used "USB AVR" as programmer but it failed due to troubles: "avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'." I read somewhere that there was troubles between AVRdude and Windows, but forums are confusing...
Thus, Forget methodologies above. Windows and programmers are apparently not the best friends in the World, due to hard communication.
Thus I bought a programmer AVR ISP from DIamex (https://www.reichelt.com/de/en/Programm ... CLE=110344). I removed the ATmega from the socket, I placed it on a breadboard, and connected the 6 pins (Miso, Mosi, Reset, SCK V+5v and GND) to the right ATmega's pins (see image 2, https://plus.google.com/u/0/photos/1146 ... _urIrOHkdQ).
After watching a bunch of tutorials with similar programmer (like AVR ISP Mk2...) I used "Burn-O-Mat", a simple interface window using AVRdude. A good Tuto (I thought that It would safe my new programmer's life) is available at: https://www.youtube.com/watch?v=jcDS8iaYS_Q
I followed the procedure (required: WinAVR, Java, programmer's driver, Burn O Mat), without modifying the fuses, as in the tuto. My programmer's name is for B-O-M software "stk500v2". I did not try with "USB AVR", as I found in the long list. I obtained a reassuring message as in Image 1 (https://plus.google.com/u/0/photos/1146 ... _urIrOHkdQ, sorry for the poor quality). It was fine, I managed to flash the f* ATmega with x0xb0x-1_03.hex! Then I replaced it in the x0x... It's time to Switch on the bass synth!
All leds are on, then off, except tempo which blinks very slowly. I can't modify the speed by turning the encoder. The bank encoder is ok: Led's sequencer are on one by one while I'm turning the "Bank" Grayhill. If I turned it too quickly in the same sense, Leds are not lighting in the same sense (i. e. the one before the one on while I'm turning quickly clockwise). Random mode produces notes, but the melody is always the same, whereas it is played very very slowly. I could check that the analogue section was okay!
And other positions of the Grayhill selector could lit up some leds, but keyboard mode doesn't work.
Half success, thus no success. Press any key to restart.
I checked soldering quality, components orientation, I don't think problem is from the hardware. Something's wrong with the Bootloader. I tried c0ntr0l but the soft failed to connect to the x0x. I tried c0nb0x but It bugged... maybe the reason is: c0nb0x was designed for windows 32.
I'm damned! x0x is an obsolete technology, 12 years after its birth???
Go back to x0x forums. (1) I think the problem comes from the fuses. I noticed on burn O mat that the box "divide clock by 8 was quoted. Could it explain the low speed of the tempo led? Another related question (2) : do I have to add a 16 MHz-crystall and 2 12-22 pF caps on the breadboard (as It is in the x0x close to µC position, please see the board conf in https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard). ANother problem is that I can't change on Burn O Mat "fuses' window" the "clock/oscillator Options (it is said "not supported by the MCU). These are my two hypothesis,the selected clock speed is too slow, I did not add an external crystall. Howeve, to modify fuses of an AVR is very risky, like "open-heart surgery" and a lot of people are complainning about "burnt" (i.e. more than toasted, "charred") ATmegas after the operation....
Any help/suggestion? Many thanks...
My last thinking (3) is: Bootloading is not sufficient to run the µC properly. DO I have to put also an updated firmware .hex file? Where can I find it, something working in 2018? C0ntr0l seems old-school and full of errors, according to previous users...
Well, I'm waiting for yours kind "debugging" tips. In parallel, I am busy with another project: a 808-like modular (with external seq) DIY drum machine. I will show it soon!
ATmegaly yours.

Posts: 2
Joined: Tue Apr 10, 2018 4:56 pm

Re: Is my bootloader faulty?

by antto on Mon Jun 25, 2018 3:41 pm

so you bought a blank chip.. that's the hard way

"random mode repeats the same melody" - that's correct, it uses an 8bit PRNG algorithm which has a very short period
"x0xb0x_1.03.hex" <- sounds old, the last "stock" firmware is version 1.05, most of the forks or modified firmwares derive from that

anyways, the biggest problem i see is that you are flashing the firmware only, then you're expecting a bootloader
the required things to "prepare" a blank chip for the x0xb0x are:
- fusebits
- lockbits
- bootloader hex
- plug into x0xb0x, use the bootloader to upload the firmware
- done

now, another option is to take the firmware and bootloader .hex files and "combine" them into a single .hex file, but this is tricky

more importantly, with atmegas, you gotta be careful not to brick the chip
bricking an atmega chip typically happens by one of the following things:
1) you disable SPI via the fusebits
2) you enable external clock source, but you don't provide it (some programmers may have a backup clock source, i think)

fusebits: http://eleccelerator.com/fusecalc/
select atmega162 there, and you can see what the hexadecimal values mean value
you can probably find (via google) what the values need to be for the x0xb0x, but from an old screenshot i have, i guess they are Low: 0xFF, High: 0xD4, Ext: 0x3F
lockbits should be 0xEF (to protect the bootloader from overwriting itself)

now, if my memory isn't failing me, when you set the fuses, specifically the one that sets the clock to external crystal, the chip will stop working on your breadboard, unless you have a crystal on it, so perhaps change the Low fuse last
- get the bootloader .hex, program it, make sure it verifies correctly
- set the High and Extended fuse, and the lockbits
- set the Low fuse
- plug the chip into the x0xb0x, try to Upload Firmware

alternatively, if you don't want to use a bootloader - turn off BOOTRST in the fusecalc applet, and program a firmware .hex directly (i don't recommend this route tho)

atmegas (as well as other chips) generally provide "in-system programming" - this means that you should be able to attach a programmer to the chip without removing it from its circuit (the x0xb0x)
unfortunately, this is not present in the actual x0xb0x, but i guess you can add it.. with some DIY

and generally, beware of new devices which ship the hardware immediately and promise great firmware/software features to come "very soon via updates"
i'd say judge by what you get at the present time

in 2018, we replace the atmega162 with an atmega2561
the bootloader on that one is better and the firmware can be uploaded via avrdude

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

Re: Is my bootloader faulty?

by tetrabrik on Mon Jun 25, 2018 5:01 pm

Hello Antto,
Many thanks for your quick and very detailed answer. It will be very helpfull since I am not skilled regarding AVR prog. I have to follow your procedure, I imagine it was ever tested, right?
Why did I choose a blank ATmega162? Because I did not find on the bay or elsewhere a pre-burnt Atmega or x0x. Willzyck stopped to ship this stuff, didn't he?
Most of forums on the subject (how to bootload) are outdated, links are dead and people are trying with different programmers methods, more or (more likely) less with success.
Maybe I flashed the old firmware 1_03.hex like a butcher (without Bootloader, I know it is not recommended for the PC to recognize the x0x connected via UART), but it works better now!
With Burn O Mat, I removed the option "Divide internal clock by 8 ". I re-burnt the ATmega on beadboard. I put it in the x0x. The keyboard responds today! ANd the phone amp is fixed also.
I have to read the manual to test sequencer... we will see.
In fact I was considering setting the fuses with a blank AVR. But it may be lethal. I have a second blank ATmega to play with. Thus I will apply your protocole. I will give you news asap.
Electronically yours,
J Ferruc

Posts: 2
Joined: Tue Apr 10, 2018 4:56 pm

Re: Is my bootloader faulty?

by antto on Mon Jun 25, 2018 5:28 pm

no, i've not programmed blank atmega162 chips
i've programmed atmega2561 chips which are part of the x0xlarge cpu modification.. but they sit on a small adapter board which contains the 16MHz crystal, so.. one less way to brick that one

use fusecalc to see what the fusebits mean (or better, the datasheet of the atmega)

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

Please be positive and constructive with your questions and comments.