a bug found in _transcribe_ code

_transcribe_ is a midi to rs232 bridge – for performance control of old video mixers and switchers – it has been available from since our launch in 2023.

by default _transcribe_ comes with mappings to control the panasonic ave55 video mixer however it was designed to be tinkered with and reflashed to map to other devices also (there is code available for mapping to other video mixers and switchers )

recently – due to some diligent debugging between myself and Robert LaPorte – we discovered there is a bug introduced when users modify the default transcribe code that maps the onboard din5-serial-midi input and output to different pins than how they are defined on the circuit.

a fix has been released now so if you are modifying firmware taken from github now this shouldnt be a problem. if you have a transcribe circuit and need any help updating firmware feel free to email me – i am happy to support you with this.

below i will explain what the issue was and why it went undetected:

mapping serial ports

the pro-micro-controller on the _transcribe_ circuit uses three different serial ports:

  • Serial – this connects over the built in usb-port and is used for monitors and debugging
  • Serial1 – this connects to pins 1=Tx, 0=Rx and is used to write to (and can also read from) the Rs232 port
  • AltSerial – this uses PaulStoffregens AltSoftSerial library to add another serial port to the pro-micro – it is used to read / write midi to the din5-serial-midi ports on transcribe:

the sparkfun pro-micro-controller we use is a breakout board for the ATmega32U4 – which is also the uC chip used on Arduino Leonardo

if we take a look at the pin table in AltSoftSerial documentation we can see that the pro-micro is not mentioned but that for Arduino Leonardo the serial pins are set to Tx=5, Rx=13:

however this is a problem for us since the sparkfun-pro-micro does not expose pin13.

in fact if we check _transcribe_s schematic we can see that din-midi-serial in and out are set to Tx=9, Rx=4: (D4 = 4 & B5 = 9)

inside the AltSoftSerial/config/AltSoftSerial_Boards.h L95-L105 we can see an alternative setup using timer1 and TX = 9, RX = 4:

and if i inspect this code on my local machine i can see that yes this config has been modified to switch the altSoftSerial pins to ones that we can use on a pro-micro board.

this means that every time that i upload firmware onto transcribes from my computer it is getting the correct altSoftSerial pin configurations, however – since this modified code sits in the AltSoftSerial package and not in transcribe code – any time someone else pulls down the transcribe firmware themself and uploads the code they are getting the default (unmodified) AltSoftSerial package so are getting that default mapping.

din-midi in and out worked on my machine! but wouldnt on anyone elses – it is my suspicion that only a fraction of transcribe users modify the firmware and also only a fraction use the din-midi ports (since it also supports usb-midi-hosts and usb-midi-devices) so i guess this bug went undetected until now.

the fix is quite easy – i only needed to fork the AltSoftSerial repo – you can see it here – cyberboy666/AltSoftSerial – make these config changes here – and then update the library being linked inside the transcribe code platformio.ini to point to this fork:

lib_deps = 
	felis/USB-Host-Shield-20 @ ^1.3.2
	blokaslabs/USBMIDI @ ^1.1.5

one small thing is that now platformio may ask you to install git on your computer so it can pull directly from this repo – but this can be done quite easily by following the steps here

the main lessons on my side is to:

  • be careful modifying code that is not in your domain – if you are experimenting take notes of what you change and do a compete reinstall of packages before release
  • always test atleast once the install process from another machine – to eliminate any local changes not being reflected in source (i now how a windows ssd in my laptop i can boot into for these and other kinds of tests)