Skip to content

Instantly share code, notes, and snippets.

@camprevail
Last active December 7, 2025 02:05
Show Gist options
  • Select an option

  • Save camprevail/f900b4640cfd6d242b6b0fbdb268c498 to your computer and use it in GitHub Desktop.

Select an option

Save camprevail/f900b4640cfd6d242b6b0fbdb268c498 to your computer and use it in GitHub Desktop.
Init sdvx amps to a set volume
/*
This code can control the M61545AFP volume chip in konami sdvx/museca headphone amps. It sends just a couple packets to init the amps to
max volume - useful for sdvx valk conversion kits.
M61545AFP Datasheet link: https://www.renesas.com/en/document/dst/m61545afp-datasheet
WIRING NOTES:
- Any arduino should work, I recommend a Pro Micro (leonardo) or and Uno though.
- It is recomennded to power the arduino with USB from the computer.
- The sdvx/museca amps use 3 wire control signal connectors labelled 12v, data, and clock. You MUST connect the arduino vcc (5v) pin to the
12v signal pins on the amps. The amps WILL NOT WORK with just data and clock. It is a reference voltage and must come from the same source
as the data/clock.
- For sdvx, couple the data wires together and send them to pin 2, and the clock cable to pin 3.
- If you can't power the arduino from the computer usb, you will need to connect the arduino gnd pin to a ground wire on the harness.
- Check the third page of the SDVX 3 manual wiring diagram - near the top left you will see the 3 signal connectors labeled SOUND F,
SOUND W, SOUND H. To the right, they go to a connector labeled SMP-09V-NC. This is probably the easiest place to tap the wiring without
having to cut any original cab wires. You might be able to squeeze dupont connectors in there, or you can buy a set of JST SM-09v connectors
(which requires crimping, but is going to be more secure).
Find this cable in your cab, you can trace it from the amps or from CN2 of the relay board. It has 3 small clear wire crimps on it. The violet wire
is pin 1 clock and goes to the arduino clock pin 3. The next 3 white wires go to arduino data pin 2, followed by yellow (to arduino 5v/vcc)
and black (to arduino gnd). The last 3 should be jumped back to the original connector - they are special controls for the game to control the
headphone amp.
*/
// Pin definitions
#define DATA_PIN 2
#define CLOCK_PIN 3
#define HI(pin) pinMode(pin, INPUT)
#define LO(pin) pinMode(pin, OUTPUT)
enum VOLTAGE: uint32_t {
_12vto15v = 0b11,
_9vto12v = 0b10,
_6vto9v = 0b01,
_4v5to6v = 0b00,
};
// SET VOLUME HERE. 0 IS MAX, 95 IS MIN.
const uint32_t ATTENUATION = 0;
const uint32_t BOARD_VOLTAGE = VOLTAGE::_6vto9v; //This seems to be the best voltage setting for 5v arduinos. It should mostly eliminate the beeping sound in the headphones.
/**
* Bits we send to the amps to set the channel volumes. See datasheet
* for the controller on the amps that is receiving this data:
* https://www.renesas.com/in/en/document/dst/m61545afp-datasheet
*
* Give an attenuation from 0 to 95 (don't use negative numbers)
*/
uint32_t get_vol_packet(uint32_t att) {
if(att > 95) {
att = 0xFF; // infinite
}
return
(att << 11) | // left channel
(att << 4) | // right channel
(BOARD_VOLTAGE << 2) | // voltage
(0b11 << 0) // EOF
;
}
/**
* Sends the given packet to the amps. The amp controller is really generous with
* the clock timings allowed, so we just bitbang a low frequency clock signal.
*/
void send_volume_packet(uint32_t packet) {
// We need to send 18 bits of data, synchronized to the clock line we generate
for (int x = 17; x >= 0; x--) {
// Set the data lines low or high depending on the bit we're sending
if (packet & (1UL << x)) {
HI(DATA_PIN);
}
else {
LO(DATA_PIN);
}
// Slight delay between setting the data line and setting the clock line
// to ensure the data is set by the time the clock pulses
delay(1);
// Set the clock high and generate a clock pulse
HI(CLOCK_PIN);
delay(1);
// Reset the data line back to low (except for the final bit, which
// needs to stay high when the clock goes low to signal a latch)
if (x != 0) {
LO(DATA_PIN);
}
delay(1);
// Set the clock low
LO(CLOCK_PIN);
delay(1);
}
// After the final bit, the data line is high after we've already lowered the clock
// so we can signal a latch -- lower it now
LO(DATA_PIN);
}
/**
* Main entrypoint.
*/
void setup() {
// Init the pins
LO(DATA_PIN);
LO(CLOCK_PIN);
// Set the initial states
digitalWrite(DATA_PIN, LOW);
digitalWrite(CLOCK_PIN, LOW);
// Send some packets
for (int x = 0; x < 5; x++) {
delay(200);
send_volume_packet(get_vol_packet(ATTENUATION));
}
// Pull the lines low and call it done
LO(CLOCK_PIN);
LO(CLOCK_PIN);
}
void loop() {
// No-op
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment