Jump to content

Calculating a Roland checksum


jjonas
 Share

Recommended Posts

Hi,

I have the following problem when trying to calculate a Roland checksum for changing the parameters of an XV-5080.

When I calculate the checksum by hand for a fixed parameter value and insert them both into the sysex stream, it works:

EVENT_ENC id=1  bank=1 range=0x00:0x7f type=SysEx \
    stream="0xf0 0x41 0x10 0x00 0x10 0x12 \
    0x1f 0x00 0x20 0x55 0x0f 0x5d 0xf7" \
    lcd_pos=1:1:1   label="TVF1"

But the following doesn't work:

EVENT_ENC id=1  bank=1 range=0x00:0x7f type=SysEx \
    stream="0xf0 0x41 0x10 0x00 0x10 0x12 \
    ^chk_start 0x1f 0x00 0x20 0x55 ^val ^chk 0xf7" \
    lcd_pos=1:1:1   label="TVF1"

Trying with ^chk or ^chk_inv both fail (I get a "Bulk dump: Check Sum Error" from the synth).

The result is the same even if I replace the dynamic value (^val) with a fixed value and have the NG calculate only the checksum.

So I'm wondering if I'm trying to calculate the checksum correctly. Here's how the checksum is calculated by hand for the first example (the one that works).

parameter address   + value  = sum
0x1f 0x00 0x20 0x55 + 0x0f   = 0xa3
31   0    32   85   + 15     = 163

163 % 128 -> 35 (=remainder)

checksum = 128 - 35 = 93 (0x5d)

Just in case it's useful (and I've misunderstood something), here's the Roland description from the synth's manual:

Quote

The checksum is a value derived by adding the address, size and checksum
itself and inverting the lower 7 bits. Here's an example of how the checksum
is calculated. We will assume that in the Exclusive message we are transmitting,
the address is aa bb cc ddH and the data or size is ee ffHH.

aa + bb + cc + dd + ee + ff = sum
sum % 128 = quotient ... remainder
128 - remainder = checksum

 

Link to comment
Share on other sites

Hi,

interesting: they are using a slightly different way to calculate the checksum.
Actually "128-remainder" is problematic, because if the remainder is 0, it would result into an invalid value (128 is outside the 7bit range).

So, I added ^chk_roland, and it masks the result with 0x7f to ensure that it will be valid.

-> http://www.ucapps.de/mios32/midibox_ng_v1_037_pre6.zip

Best Regards, Thorsten,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...