Aug 252012
 

When I recently replaced my old Windows XP box with a brand-new laptop running Windows 7 on a 64 bit CPU, I was surprised by an unexpected annoyance:

For years, I had connected my old PC to a Yamaha Clavinova CLP-130 keyboard, using the TO-HOST connector in the keyboard, and a “CBX” driver downloaded from the manufacturer web site. The CBX driver converts the serial port into a MIDI port, in such a way that an application that reads data from a MIDI port is able to receive input from the Clavinova (as my computer lacks a serial port, I am also using a serial-to-USB device).

The full hardware+software setup is as follows:

The issue was that, even if the CBX driver installed without errors or warnings, the MIDI device did not appear in the “Sound, video and game controllers” section in Control Panel > Device Manager. The application I run to read data from a MIDI port did not recognize it either.

Google-ing for information on this issue, I found that there are may users that have encountered the same problem, and Yamaha doesn’t seem to be working on fixing it by developing a version of the CBX driver compatible with Windows 7 64-bit.

In this post I explain the steps I followed to solve the problem, making use of free, open source resources available on Internet.

1. Virtual MIDI port installation

There is a MIDI driver named LoopBe1 that can be downloaded from http://nerds.de/en/loopbe1.html. This driver is a software implementation of a pair of connected MIDI-In, MIDI-out ports: Data written to the MIDI-out port can be read from the MIDI-in port.

Once installed, the MIDI device appears in the relation of “Sound, video and game controllers” in Control Panel > Device Manager:

I also confirmed that the application I use to read data from a MIDI port detects the newly installed driver. Now, the issue remaining is how to send to the MIDI port the data sent from the Clavinova to the serial port (through the serial/USB converter) to make them available to the application.

A software utility “clavitopc” running on Windows 7 had to be developed to implement this serial-to-MIDI conversion. Using this converter, the new setup would be:

Note: If you are interested in the final solution rather than in the technical details of the development, you can skip the next sections and go directly to “Installation an execution of clavitopc”.

2. Development Environment to target a Windows 7 64 bit platform

In order to develop the application, I chose IDE Code::Blocks. This IDE employs the GCC compiler from MinGW.

After downloading and executing the binary release “codeblocks-10.05mingw-setup.exe”, running the IDE displays a window where we can start creating C/C++ projects:

 

3. Documentation and sample code

To avoid having to develop the application from scratch, I searched in Google sample C programs for the communication through serial and MIDI ports, and reference documentation. The most relevant links I found are:

  • MTTTY (Multi-Threaded TTY) – This sample application implements a terminal window to communicate through a serial port. The sample appeared first in a MSDN article about Serial Communications in Win32. MTTTY is not only a good example for programming input/output through a serial port, but also for multi-threaded programming, and for the implementation of a simple user interface making use of Common Controls.
    Although the download link in the MSDN page does not work anymore, I found a copy of it in http://forums.codeguru.com/showthread.php?249306-MTTTY-Sample-Program. The mttty.zip file with the source code of mttty can also be downloaded from here.

 4. Installing and running clavitopc

Just download the clavitopc.exe executable in the Desktop, and double click on the icon. The program opens a Command Window (that can be minimized) where some initialization messages are written. To end the execution of clavitopc, just close the window.

By default, clavitopc opens the COM2 port. A different port can be specified as an argument if the program is called from a CMD window:

Disclaimer: The clavitopc.exe application is offered free of charge with no warranties of any kind. By downloading it, the user accepts this fact, and understands that the use of the application is done under his only responsibility, and that the application is offered “as is”.

 Posted by at 9:03 am

  7 Responses to “How to connect a Clavinova keyboard to a Windows 7 64bit PC serial port”

  1. I have only 1 COM port which is COM1. It appears in my control panel and seems OK. When running clavitopc COM1 (in a DOS windows as administrator), it says

    connecting to serial port: COM1
    Serial port successfully opened
    Calling SetCommState
    Calling SetCommTimeoutsCalling SetupComm
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    dwRead: 1
    Error in call to WaitForMultipleObjects(Reader & Status handles)
    Error in call to WaitForMultipleObjects(Reader & Status handles)
    …………

    What’s wrong?

    • Hello Guido,
      I am sorry to say that from the information in your post it is not possible to find out the reason of the issue you report. Is your COM port a physical port, or are you using a USB-to-serial adapter ?. I would suggest you to review the configuration of the COM port and play with the parameters (data bits, stop bits, flow control, etc.). Unfortunately, issues of this kind are hard to fix remotely.

  2. Thanks for the reply. It’s a physical port. Meanwhile, I simply renamed COM1 to COM2 to and ran the executable without parameters: same result. I will try your suggestion.

  3. Hello Admin,

    thank you very much for developing “clavitopc”.
    It’s excectly what I need.
    Unfortunately the download link doesn’t work.
    could you please help me?

    Greetings
    Uwe

  4. Hi, you have done a great job !!!

    So, I want to connect my old Yamaha 9000pro keyboard to my Win 8.1 netbook.
    It has the classic TO HOST connector .

    As I understand I have to use: 8 DIN conector to RS232, then RS232 to USB, isn’t it? And then your programs…

    Which adaptors do you use?

    http://www.yamahaforums.co.uk/forum/download/file.php?id=520&sid=1d454dfca9144a37a3d0d2a97ddc3707&mode=view

    Thank you very much
    Heraclitos

    • Hi Heraclitos,
      I didn’t use nothing special, just a common RS232 to USB adaptor I bought at a supermarket close to my home (Auchan, part number G1102145). I guess that any other brand and model would be equally valid.
      I made myself the 8 DIN conector to RS232 cable, following the documentation that came with the Clavinova (same as in the drawing you link to in your comment).
      As the article states, the program was developed for a Windows 7 machine and I haven’t tried it on Windows 8.1. I wish you good luck, if you decide to try it.

 Leave a Reply

(required)

(required)