MIOS Bootstrap Loader for Newbies

The MIOS Bootstrap Loader is a special firmware for the PIC18F which allows you to upload MIOS (the operating system) and a MIOS application (the program) into the PIC flash memory via the MIDI interface.

The big advantage of the bootstrap method is, that you don't need a PIC programmer to install the software on your MIDIbox, instead you can buy preprogrammed PICs from SmashTV or Mike, or you can ask a friend or a member of the MIDIbox Forum who already owns a PIC programmer for burning the bootstrap loader into the chip.

Even for people who own a programmer, the bootstrap loader brings benefit, because the usage is much more comfortable; it's possible to upload new code on-the-fly without unplugging the PIC from the MBHP_CORE module within a few number of seconds!

Take two

In fact two bootstrap loaders do exist:

  • The primary bootstrap loader, which has been installed with a PIC programmer. It will be active for the first 2 seconds after power-on and provides a very basic functionality to upload MIOS and applications.
  • The secondary bootstrap loader, which is part of MIOS, and provides enhanced functionality, such as programming external EEPROMs (Banksticks).

It's important to know, that MIOS itself can only be uploaded with the primary loader. Applications can always be uploaded - if not, there is an error in the application which prevents this, but in this case you could just use the primary loader in order to refresh the code under safe conditions (just push the start button in MIOS Studio, and power-off/power-on the core or trigger the external reset by tipping ground to pin #1 of the PIC).

Uploading MIOS

After the bootstrap firmware has been programmed into the PIC, the core won't do that much. For example, the LCD will stay blank, and even if you would try to upload an application via MIDI, nothing would change. This is because MIOS is missing which provides all the basic services (e.g. MIDI protocol handling, Pot/Button/Encoder scanning, LED and LCD output, etc), so let's upload this nice piece of software first!

Link to MIOS Studio Download MIOS Studio - this is a Juce based environment with MIOS specific tools which runs under Windows, Linux and MacOS.

Once the most recent MIOS Release has been installed on the PIC, the core will reboot and MIOS Studio should display that an application is up&running. If a LCD is connected to the core, a copyright message, and short time later a READY. should appear on the screen.

Uploading an application

Now you can upload an application, just while MIOS is running. You can exchange the application whenever you want, the system will always reboot after the upload (thats not an error), so that the application can be initialized properly. Note that it is not possible to run multiple applications in parallel - a new application will always overwrite the old one.

Some applications require hardware configuration! E.g. an application cannot determine, which LCD is connected to the core. Such options can mostly be found in the main.asm or setup_*.asm file of assembly based apps, and in the main.h file of C based applications (sometimes there is also a README.txt which gives a basic overview). This HowTo describes the required procedure to edit the code and to build a new .hex file.

Additional Hints

  • If you upload an application which reacts on the analog input lines of the PIC or an AIN module (e.g. MIDIbox64 or MIDIbox LC), the core will propably send a lot of random MIDI events as long as no pots/faders or other voltage sources are connected to the analog inputs - therefore all unusued analog inputs should always be clamped to ground.
    Please refer to this wiring diagram for a better understanding.
  • if multiple cores are connected to a single MIDI port in parallel or in a chain, each core should get it's unique device ID, so that the upload tool can address the code to the right receiver. The device ID is part of the ID header, which can only be modified during the flash programming of the bootstrap loader, or with the change_id application.
    The device ID selected in the upload window must match with the device ID of the core which should response to the transfer.
    This means in other words: after the MIOS device ID has been modified by the change_id application, the ID in the MIOS Studio Upload Window has to be changed as well, so that it matches with the new ID value.
    As long as only one MIDIbox is connected to the MIDI port, it's safe to use device ID 00. A project where different device IDs are required is the MIDIbox SID (the master gets the ID 00, the slaves the IDs 01, 02 and 03)
  • Please note: like every MIOS application, change_id won't work as long as MIOS hasn't been installed. So, please upload MIOS first, thereafter upload the desired .hex file of the change_id application.



Last update: 2024-05-08

Copyright © 1998-2023, Thorsten Klose. All rights reserved.