SF Bay Music Tech


When man pages of Linux system calls and POSIX library functions are missing (Debian / Ubuntu)

Filed under: BeagleBone,tech notes — Gan @ 4:50 PM

manpages-dev: Manual pages about using GNU/Linux for development

manpages-posix-dev: Manual pages about using a POSIX system for development


Enable CAN on the BeagleBone Green

Filed under: analog3,BeagleBone,CAN,tech notes — Gan @ 8:42 AM

I’ve tried to enable CAN on my BeagleBone Green board. I had to stop the work before verification, because my logic analyzer is unavailable now. I record what I did in this article to make things reproducible when the logic analyzer is back.

There are several helpful links:




Readings to understand device tree overlay:

Device Tree for Dummies:

Device Tree Overlays (in adafruit)

Here are what I did:

Then I have to stop here.


BeagleBone notes

Filed under: analog3,BeagleBone,CAN,tech notes — Gan @ 4:03 PM

How to login from MacOS:

  1. Connect to the BeagleBone by a USB cable.
  2. MacOS restart is necessary for some reason.
  3. SSH to

WiFi setup:

Use connmanctl as described in /etc/network/interfaces.

… and so on

Following links give useful information:
http://xx-prime.hatenablog.com/entry/2016/08/13/012059 (in Japanese)


The wlan0 device power management can be turned off by

TBD how to turn this off permanently.

Take SD backup

  1. Insert the SD into the MacBook
  2. “diskutil list” to know the path to the device.
  3. run “sudo dd if=<device_name> conv=sync,noerror | gzip -c > archive.img.gz

Following link is helpful to know how to backup disks in several styles:


Connecting to the host via serial port

Useful when the SSH access has a problem:


MCP2515 beyond 1MHz

Filed under: analog3,CAN,tech notes — Gan @ 9:50 PM

For archival purpose:


you are certainly right about 1Mbps being the maximum speed of the official CAN spec. However, some of us like to break the rules :)

I do :)
I’m using CAN for a purpose different from controlling automobile so my breaking rule would not cause any death.


Use USB-UART Bridge on PSoC CY8CKIT-049-42xx Kit

Filed under: analog3,PSoC,tech notes — Gan @ 11:26 PM

You need miniprog3 to program this, despite typical programming to this kit is via boot loader.

1. Put a SCB UART component. Change baud rate to 9600.

2. Assign pins as follows:

UART RX : P4[0]
UART TX : P4[1]


3. And then, here is the main.c source code

4. Build it, program it, and connect the CY8CKIT-049-42xx to the PC.

That’s it.


Generating MCP2515 SPI ‘READ’ Operation Request Using PSoC 42xx

Filed under: analog3,tech notes — Gan @ 7:21 AM

PSoC 42xx provides SPI component that supports up to 4MHz clock speed. Communicating with MCP2515 via this component, however, is not straightforward when you try the highest clock speed.

The problem is concept of ‘operation’ of MCP2515. An operation consists of multiple SPI bytes bundled by ‘enable’ signal on the CS pin. Lowering the CS pin initiates an operation and it must stay low during the data transmission. See following timing chart quoted from the MCP2515 datasheet.


The PSoC SPI component lacks direct control on the CS pin signal. The component automatically lowers the CS level when the write API puts a byte to Tx FIFO and the component’s internal logic raises the CS level when all FIFO values are consumed. But auto-generated API functions are not fast enough due to overhead to make the functions generic. Then, the CS signal may split during an operation when Tx FIFO becomes empty due to the API failing to catch up with the desired speed.

I wrote a function that generates a valid READ operation frame and retrieves returned bytes. The strategy is:

  • Use lower-level component interfaces to avoid overhead.
  • The function pushes sending bytes to Tx FIFO as fast as possible to keep it non-empty during the operation.
  • Concurrently read data from Rx FIFO as fast as possible to avoid FIFO overflow.

There are limitations to use this functions:

  • Both Rx and Tx buffer sizes of the SPI component must be 4. PSoC Creator generates software buffer when the sizes are larger than 4. That makes source code management too complicated.
  • The first two bytes in output array are dummy that do not mean anything. Actual retrieve data starts from the third element.
  • The function may need to disable interrupts during the operation, though it is still missing in the implementation.

Here is the source code. In this example code, the SPI component name is ‘SPIM_CAN’ which is a master SPI component (non SCB).

Tried reading 16 bytes from MCP2515 using this read function from a 4MHz-clock SPI of a PSoC Pionner Kit. The CS (Enable) signal stays low during the operation, as expected.




exp() calculation for micro processors

Filed under: analog3,tech notes — Gan @ 4:50 PM

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.



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

Filed under: analog3,tech notes — Gan @ 6:59 PM


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

Filed under: analog3,tech notes — Gan @ 5:48 PM

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

Filed under: analog3,tech notes — Gan @ 5:23 PM

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.


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


AVR Example Code (C)

Older Posts »

Powered by WordPress