Installed Necessary Applications

I like OS X as a software development platform (and electronic stationery); On the other hand, it’s much better to use Windows for hardware development because of better coverage of development tools. As a compromise, I own MacBook and runs Windows under Parallels Desktop for hardware development. I have no issues with this style so far thanks to the powerful USB support by Parallels.

My Windows platform has reached disk size full at 64GB. I decided to extend the disk size and re-install everything. Here are highlights of my Windows platform:

  • Windows 10, display language = English
  • PSoC creator 3.2 for the PSoC development platform. 3.3 is installed by I am not using it yet since I saw some instability. (install image =PSoCCreatorSetup_3.2_sp1_b6175.exe)
  • Salae Logic 1.2.10 (Logic Setup 1.2.10.exe) for logic analyzer. No particular issue. Working fine with a normal installation.
  • PicoScope6.11.12 (PicoScope6_r6_11_12) for my oscilloscope PicoScope 2203. The hardware has become EOL already but it is working with this version of Oscilloscope app. Note that OS X version requires installing .NET libraries. I hate it so didn’t install on Mac.
  • Foxit Reader 7.2.8 (FoxitReader728.1124_enu_Setup.exe) for PDF reader. The version is important. Never upgrade this until FoxIt resumes support of classic toolbar mode. The latest version supports only ribbon mode and it painfully takes space on my small screen. Otherwise, this viewer is very comfortable to use. Note: Turn off the automatic upgrade functionality.
  • TeraTerm 4.91 (teraterm-4.91.exe) for terminal emulator. TeraTerm has several variations/providers for some reason. I always get confused by it. This is the one I use, for my future reference: https://ttssh2.osdn.jp/index.html.en
  • Eagle 5.12.0 It’s very old version but I keep using it because this is the version where I have commercial license (which was quite expensive). Cadsoft who were former provider of Eagle was acquired by some other company, so I’m not sure if the latest version is “better” or “improved”. I want to avoid spending extra time for researching it, so I will stay with this version as long as possible. I’m happy with the feature at this point anyway.

That is about it. I have not installed Cygwin yet. I’m waiting for Ubuntu/bash is officially supported by Windows 10.

I have archived these install images in my ‘software’ folder for any needs for recovery in future.

MIDI Receiver Module

schematic

DSC02703

My PSoC Creator application became unstable suddenly. I could not work on software today. I’m now recovering the software.

Meanwhile, I made a MIDI receiver module instead. Developing and debugging MIDI Rx would be easier and less troublesome hopefully.

Not yet verified the behavior.

Analog3: The First Use Case

DSC02688

One year has passed since I stopped working on Analog 3. Now it’s time to resume the development. The picture above is the first use case of Analog 3. This is a draft panel layout of the synth I want to make. The panel includes least set of parameters I want.

Many parameters on this panel has non-traditional style, like ones in VCA. I will need to revise and adjust such parameters. In order to avoid remaking hardware modules, I will control the risk by following approach:

  • Develop the synth by modifying a working complete set of synthesizer, i.e., the base platform. I will use the Analog2.0 fundamental set for it.
  • Modification is done by replacing a module.
  • New modules have analog panel.
  • Base platform keep using the existing hardware panel.

I can always verify the complete set is working by this approach.

The first task, then, is to build an Analog2.0 box.

exp() calculation for micro processors

You frequently encounter a situation that exponential function is necessary when you work on a musical instrument project using micro processors.  Its generic implementation is slow and space consuming, so is not suitable for micro processors.  So I need to do some alternative implementations.  For those implementations, space and speed is important but accuracy may be sacrificed in many cases.

Follows are articles about fast and compact exp() implementations, for my future reference.

http://www.convict.lu/Jeunes/ultimate_stuff/exp_ln_2.htm

http://www.quinapalus.com/efunc.html

I’m currently using a table lookup approach that I implemented before for an envelope generator I prototyped before.指 This one is still a little slow and large, but it’s running in PSoC 4200 without major problem anyways.  So I’ll keep it for a while.

Memo: Maven

Installation

How to install Maven on Windows

Maven is a Java application, so we are just fine with expanding product zip package and setting environment variables M2_HOME and JAVA_HOME and set PATH.

Creating a Maven Project

Maven in 5 Minutes

Maven in 5 seconds… dothis:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Stub Synth Module for MOM Development

MOM (Master Of Modules) manages synthesizer modules to make them work as a single musical instrument.  The main responsibilities of MOM are

  • Control patching.
  • Control parameters.
  • Organize voices.
  • (possibly) Organize modules such as device ID management.

Designing and implementing MOM and synth module data model is yet another challenge out of building CAN network.  Basically, the inter-module communication depends on CAN physical layer, but it’s a pain to dragging such a dependency during the MOM development.  I’m sure the CAN network would be quite unstable at first and I don’t want to stop and troubleshoot CAN while I’m working on MOM.

So, in order to remove dependency on CAN network, I’ll build the initial version of MOM based on TCP/IP with dummy (stub) synth modules that are purely software oriented and talk TCP/IP.  Once the MOM design is fixed, I can replace the TCP/IP driver by CAN driver later.  It will not ruin the module data model.

MCP2515 CAN Controller

As I mentioned in the previous article, I’ll use MCP2515 CAN controller for inter-module communication (initially, at least) for the Analog3 Project.

Datasheet of this device is available at the product page.

MCP2515 consists of CAN protocol engine, data buffers,  controller, and SPI interface as illustrated in the picture below.

MCP2515_block_diagram

a3_networkYou need to attach a processor to make this device functional.  In early phase of the project, I’m thinking of using a Raspberry Pi as the Master Of Modules (mom) and Arduino’s for dummy synthesizer modules.  Arduino is not a realistic solution for Analog3 both in terms of cost and performance.  So, I’m thinking of implementing a common synthesizer module driver based on PSoC or CAN enabled AVR.  MCP2551 in the picture is a CAN transceiver BTW.

It may take a while to get used to MCP2515.  Here are several links that are useful for getting started:

MCP2515 Linux Device Driver (probably for Raspberry Pi)

Arduino Example Sketch

https://gist.github.com/rechargecar/4177820

AVR Example Code (C)

Changing the Strategy for Analog3

I’ve been trying for a year to make my own serial interface protocol to exchange data among synth modules.  Though it showed some progress, I kind of giving up this approach.  The problem is complexity of serial interface controller.  A controller for multi-master serial interface is complex.  Implementing using a generic device is more costly in many sense than I expected.  I started with Arduino.  This was the easiest approach but channel was too slow.  I could only achieve 50kbps.  Then I tried implementing it into AVR using assembler language.  It went 100kbps but it was about the limit.  The most serious problem with MPU was that the processing is always on single thread.  Some data processing has to be done in parallel during data reception, but it was pretty inefficient to run such concurrent tasks on 8-bit simple processor.  Overhead for such multi-tasking killed the speed.  Then, I moved onto PSoC.  It achieves bit rate 400kbps easily and it might go higher if it’s tuned well.  However, the logic to handle collision is so complex that I eventually am suffered from lack of resources in PSoC.

So at this point, it seems more practical to use a ready-made implementation of an existing protocol, which is CAN.

The reason I didn’t go for CAN at first was speed.  I wanted to use the interface even for synching oscillators.  I was not sure if 44bit-at-shortest message from at 1 Mbps is short enough for that usage.  (I’m not sure yet.  It’s about 22kHz rate if you keep repeating shortest CAN message at the highest rate.  That’s pretty close to audio frequency.  If an oscillator keeps sending such messages, the communication channel would be pretty much occupied.)  So probably I need to give up some usage of the common data bus.  I will go with following approach:

  • Use cheap CAN controller and transceiver: MCP2515 and MCP2551.
  • MCP2515 is controlled by SPI.  Most processors can use it.
  • I’ll use Raspberry Pi for the master synth controller module.
  • Synth modules can be based on PSoC or AVR.  These two are ones I am familiar with.
  • I’ll give up some features such as oscillator sync network.

I’ve placed an order to get these parts.  This part is blocked until the parts arrive.

Raspberry Pi I2C clock-stretching problem

The I2C slave that I’m developing has been failing intermittently.  I finally noticed this was a known bug in Raspberry Pi that mishandles clock stretching.

I2C slave may delay response by holding SCL low.  However, when the slave does it, the I2C master in Raspberry Pi gives very short clock for the first bit of the next byte.  The symptom can be seen as following picture.

10678616_689709434441211_7585444260259589843_n

More detail explanation can be read in this link:

http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html

In order to workaround this, I set data rate in I2C slave module higher.  The communication rate is 400 kbps, but I set the data rate 1000 kbps.  It worked for me.  Here is the setup of I2C slave module.

I2Cslave