• entries
  • comments
  • views

About this blog

Midibox controller

Entries in this blog


Yes, i admit, i'm slow as a turtle. But as a turtle i've put out my head, and today out in direction to the blog! :)

Ok, jokes apart, in the previous step i've explaned how to get installed the needed tools to compile apps for our beloved Core controller, in this third step we will see how to get the SVN repository and then how to get and app compiled and ready as an .hex file to upload to our Pic Core, or Core32.

First thing is opening the Terminal.

Since the last step i assume that we get familiar with the Terminal window so i'll not explain where and how find it in our Macs!

Once you have the terminal opened, go to your home folder.

Usually when you open Terminal you're already on the Home folder, and you'll see your mac login name on the left of the cursor.

Just type

and hit return. You'll see a list of files and folder, open via finder your home folder, if you see that the files are the same you are surely in the home folder with the terminal. Otherwise you're in another folder and what you have to write in the terminal is the following command
cd Users/yourhomename
It will bring you to the home folder. Home folder that will be the folder where we will put the mios, or mios32 repository. With Terminal opened write this command
svn co svn://svnmios.midibox.org/mios
You'll see that the Terminal will start to download all the repository files in a folder called mios in your home directory. We are downloading this repository in the home folder because we will have to set a .profile file needed to the compiling process. I'll explain his purpose later. Ok, when the Terminal have finished the download, we will see a folder called mios in our home with inside it two folders, trunk and playground. We will concentrate on trunk, the place were all what we need for our apps is placed. But, hey, we forgot the SVN32! Simple task, repeat the same command "svn co" but this time with the svn32 address:
svn co svn://svnmios.midibox.org/mios32
At the end of the download you'll have the core32 repository, always in the home directory. Now we have both core and core32 repository in our home folder. You should see mios and mios32 folders. Well, start to compile! No. Do you remember the .profile file mentioned just before? We have to edit it so the tools installed in the Step 2 will work flawlessy. Don't ask me more about this, as i'm learning like you and sometimes i know that things must go in this way but i don't know why because i haven't yet understood all. I know that's not brilliant, but at the end i've the compiling process working! :) (i hope to explain better why to modify .profile page as soon as possible!) Let's go on modify our .profile page, you braves! On terminal write this command (be sure that you're in the home folder "/Users/yourhomename", not in another folder like mios or music ):
open .profile

You'll see a textedit file opened. Put at the top of the file this code if you are using the mios repository:

# mios

export MIOS_PATH=/mios/trunk


# mios end

Put this code if you are using the mios32 repository:

# mios32

export PATH=$PATH:/usr/local/stm32/bin

export MIOS32_PATH=/mios32/trunk

export MIOS32_BIN_PATH=$MIOS32_PATH/bin

export MIOS32_GCC_PREFIX=arm-none-eabi

export MIOS32_FAMILY=STM32F10x



export MIOS32_LCD=clcd

# mios32 end

If you're using both the repository put this:

# mios

export MIOS_PATH=/mios/trunk


# mios end

# mios32

export PATH=$PATH:/usr/local/stm32/bin

export MIOS32_PATH=/mios32/trunk

export MIOS32_BIN_PATH=$MIOS32_PATH/bin

export MIOS32_GCC_PREFIX=arm-none-eabi

export MIOS32_FAMILY=STM32F10x



export MIOS32_LCD=clcd

# mios32 end

Save the file (cmd+S) and then close. Now, to refresh the system with the new .profile file we have to write this in the Terminal window:
. ~/.profile
Be careful to include also the first dot! Best way copy and paste. ;) Once the .profile file is refreshed we can now go with our terminal to an app folder and try to compile it. But before i advice you to do always a backup of the folder that contains files needed to compile. My workflow is the following: I need to modify and compile the blm_scalar app. I copy the blm_scalar app folder in another backup folder, folder that can be placed anywhere outside the mios, or mios32 folders. I will have in this way an original copy of the svn downloaded one. Now that we have placed the original copy in a secure place we will start to go into our app target folder with the Terminal: When you are in the home folder with the Terminal write this command
cd mios/trunk/apps/controllers/blm_scalar
You'll be in the blm_scalar folder where all the .c, .h and makefile, needed for compiling, are located. Remember that you must go in an app single folder with Terminal to have the compiling process working. I mean, if you need to compile the midibox64 app, you will ahve to go to the midibox64 folder through the command
cd mios/trunk/apps/controllers/midibox64
and so on for the other apps. I advice you to check out the apps and the relative folders path via finder, and then write the needed path in the terminal. Ok, returning to the our folder, blm_scalar, we are ready to compile our target app. You should have in terminal this position:
macname:blm_scalar yourhomename$ 
What you have to do now is simply write in Terminal
The terminal will print out some text and then the prompt will be back. And now? Check out what changed in the folder via the Terminal command

You can check out what changed also with finder going into the blm_scalar folder.

You should see that some files and a folder were created!

And....you should see project.hex, our compiled app ready to be uploaded to our core!

Ok, now that we had this file how we can upload to our core?

Simple, we will upload it using MIOS_Studio!

Download it from here, scroll the page to the bottom, you'll find the download links for mac and windows.

In the meantime that connect your Core board to your computer via midi, connecting both midi in and midi out.

Once the MIOS_Studio is downloaded, place it in your applications folder and then launch it.

Click over the browse button, go on the blm_scalar folder located in /"home"/mios/trunk/apps/controllers/blm_scalar, select the project.hex file and click ok.

Then click the start button and the progress bar will raise up with the upload of the project.hex file!

When finished your core will reboot and in the MIOS_Studio you will see a "ready" text!

You have now your app compiled and uploaded!

Consider that the same process is valid when you modify apps and the you'll upload them, is the same also if you are working with the mios32 svn.

But remember always to backup the apps folders and to check if the svn is updated!

I'll write about the modify of the app later as is something that i've not yet learned.

In the next step i'll write about the components needed for my specific controller project and write about some other thing that i'll think over in the next days/weeks! Remember the turtle! :)


Ok, today i woke up with in mind to update the blog, too much days since last post!

We will see how to install all the packages and tools necessary to compile our coded applications in uploadable .hex files for our ucApps Core Modules.

I will cover the OSX side as i'm working on this platform, so i'm sorry for pc users (that can always find useful informations over the wiki pages).

Here's the list of the tools needed (follow the order to install them!):

  • SDCC


That's the Apple IDE system needed to edit our applications.

It is also needed to install SDCC later, so it will be the first app that we will install!

If you have an Apple ID go to the Apple developer page:

Xcode Page

and download XCode.

If you don't have an Apple ID Code, register an account in the same page and then download and install it.

You will download XCode in a packgage, so you'll only open the installer and follow the classic installer steps.

It's easy to install XCode!


After you have installed XCode we will install GPUTILS.

In our mac press command+spacebar and in the spotlight form write Terminal or, via Finder, go to Application/Utility/Terminal.app .

Ok, now we will write the following line to have the GPUTILS source downloaded in our HD:

svn co https://gputils.svn.sourceforge.net/svnroot/gputils gputils

(This will take some time before it finish to download all the files, so take something to drink in the meantime!) Once the GPUTILS download is finished we will go into a specific folder of the downloaded source with the Terminal:

cd gputils/trunk/gputils

Now that we are on this folder we'll write on the command line:


(This will configure the source for your system) We are ready now to compile! Write on the command line:


and then continue with this command:

sudo make install

(sudo command is required and will ask your system password!) Now, using the command

cd ..

go back to the folder where the GPUTILS source folder is located (repeat this step more times, and use the "ls" command to view the current folder contents) and then delete it with the following command

rm -Rf gputils

(You can delete it also from the finder) SDCC Now we will install SDCC. For this one, also if sources are available, i will follow the Macports way to install it. First step is to install Macports: Download page There are different installers for the different osx systems, choose the one that fits your system. The installer comes, like the XCode installer, in a self installer package, also this one is easy to install! After you have installed Macports you'll have to write in the Terminal:

port search sdcc

(This will show you the available version in macports) Then we will install it writing this command, always in the terminal:

sudo port install sdcc

(As before, take your time with a drink, some time is required before the install process finish).

After this step you'll have SDCC, GPUTILS and XCODE installed!

You have now the tools needed to compile the ucapps applications!

In the next blog entry i will explain how to download the MIOS and MIOS32 svn's to your mac and how to compile applications to have .hex uploadable files.


As said in the previous post, this midibox project will be designed to control NI Traktor software.

Inspired by a commercial product i've estimated the number of components:

50 Pots

9 Encoder

150 Leds

160 Push buttons

5 Faders

USB interface

The pots, encoders, leds and buttons numbers are an estimate, remains that their number can change while the project goes ahead.

So, now that we know an estimate of how many components we need, we can start to looking at the ucapps.de modules.

The Core

I've said that we need an usb interface.

For this task we can use the good old PIC Based Core with MIOS8 adding an USB module like the USB GM5 Module, but this means that we have to buy a PIC Based Core plus buy a dedicated board for USB. Then connect them.

Why don't use an integrated solution "Core&USB"?

Luckily since some time we have a new core module, the STM32 Based Core which have integrated usb (2in and 2out), more Flash and Ram space for custom applications, and last, but no less important, we don't need to know "assembler" coding.

"C language" coding knowledge is the only thing required to build custom applications, thanks also to the code examples that we have on the documentation.

Then a lot of other useful STM32 Based Core features can be found on his dedicated page.

Analog Inputs

Around 50 Potentiometers and 5 Faders.

Yes, all these, like in a classic dj mixer with effects.

To send the analog signals from the Pots to the STM32 Core module we need 2 AIN (Analog INput) modules.

Each module have, in his board, 4 multiplexer units, each one with 8 inputs. So, 4 multiplexers with 8 inputs each one means that with 1 AIN module we can have 32 pots connected to the STM32 Core module.

But we need more than 32 input: from the AIN documentation we know that we can chain more AIN modules, so adding another AIN module can fit our needs.

2 chained AIN modules equals to 64 Analog inputs, we need around 55 inputs, so the mission is accomplished!

Digital Inputs and Digital Outputs

In the past, connecting Led's and Buttons (discrete on off values, 0V or +5V) required the use of more DIN (Digital INputs) and DOUT (Digital OUTputs) modules for about 64 leds and 64 buttons (a classic Midibox64).

This time we need about 150 Digital outputs for leds and 160 Digital inputs for buttons.

If we think about DIN and DOUT modules we know that each module, via 4 multiplexers with 8 in/out each one, can handle 32 digital inputs (DIN Module) for buttons and 32 digital outputs (DOUT Module) for leds.

With a simple math we know that to fit 150 leds and 160 buttons we need about 5 DIN Modules and 5 DOUT Modules.

This high amount of modules means also an high amount of power absorption, so the core module can't be only powered via an USB connection, but surely the system will require an external PSU to supply the necessary amount of current.

How to switch off this problem?

Using the BLM system (Button Led Matrix).

This is a new system used to connect digital inputs and outputs, each BLM module can handle 64 buttons and 64 Leds. Calling our friendly math we can consider that for 150 leds and 160 Buttons we can stay very large using 3 BLM modules!

Then this system reduces dramatically the power absorption so also the USB powered mission is accomplished!

Hey! But i've forgot the Encoders!

Encoders can be considered like 2 buttons, one to go up with the values, and one to go down. So we have to considerate, for 9 encoders, 18 digital inputs to the Core.

Unluckily the BLM module can't handle encoders, we have to use a dedicated DIN Module for these encoders. But luckily, this time, the BLM modules have a DIN chain, so after the last BLM module we can append a DIN module for our encoders. Problem Solved!


After all this clear/unclear (absolutely revisionable) project explanation, here's the list of modules required:

1 STMCore32 module

2 AIN Modules (chained)

3 BLM Modules + 1 DIN Module (all 4 chained)

Seems an effortless task considering that almost all the PCBs, except the BLM module that will require a custom design, are premade by dedicated PCB producers.

During the development of the project nothing can exclude that i'll do a custom single PCB board for the system. We will see this later.

Next post will be about the tools setup, needed to compile uploadable .hex files to the core module (Both PIC and STM32), on osx system.



Ok, i'm starting this blog to have (and to give) a "document" of my work about the building of a Traktor Controller.

I had this idea in my head since 2 years, and i'm starting now because i'll use this project for my "Multimedia Design degree thesis".

I'm not entirely outside of the Midibox projects, 3-4 years ago i've succesfully builded myself a MidiBox64, but i've never touched something related to the assembler, nor the new C platform programming. Simple way, i've never programmed for MidiBox.

This time, my Traktor controller project, will require a bit of software programming skills and a bit of pcb design to adapt all to my needs.

To fit the case design, in a cool way, probably (if not surely) i'll have to design my pcb's, and for the software side, to have all working, i'll merge C code bits taken here and there in the documentation.

So i'll post here all my successfully steps to have a useful "roadmap" for who is going, in the next times, to learn about midibox controller projects, like me now!

Have fun!