Home AMX User Forum MODPEDIA - The Public Repository of Modules for Everyone

Miranda CR3232 Protocol

Hi,

I need some help from you guys, having trouble to understand the protocol of this HD-SDI Switcher. I just need the switching command.

Thanks guys

Comments

  • JasonSJasonS Posts: 229
    Do you have any documentation on the protocol?
  • mny_minemny_mine Posts: 5
    Manual
    JasonS wrote: »
    Do you have any documentation on the protocol?

    Hi, i've been reading this manual for days and still cant really get it. Thanks before hand.



  • JasonSJasonS Posts: 229
    Wow, this is a good one! How familiar with bit operations are you? I think the easiest way to deal with alot of this is going to be using long values, but you will have to do bit shifting inorder parse your groups of 4 bytes into long values. But that is if you want to fully implement the protocol. How much control over this matrix do you need? If you are just making a couple routes it will be easier to just figure ou those specific messages and can them. Without having a unit to play with here is what I think at a cursory look:


    0x0000000C - Router Control Protocol
    0x00000001 - Sequence Number
    0x00000024 - Byte Count (Totla Byte Count)
    0x00000050 - Take Command
    0x00000001 - Number of Takes in message
    -- Start of Take Data --
    0x000000xx - Level Number
    0x0000F000 - LPR ID (Fixed value indicating Generic 3rd Party control)
    0x000000xx - Source
    0x000000xx - Destination
    -- End of Take Data --
    -- End of Message --

    Yielding in AMX style:
    $00,$00,$00,$0C,$00,$00,$00,$01,$00,$00,$00,$24,$00,$00,$00,$50,$00,$00,
    $00,$01,$00,$00,$00,$xx,$00,$00,$F0,$00,$00,$00,$00,$xx,$00,$00,$00,$xx

    I think sequence number will have to change for every message, byte count will have to be set based on message length (this one would be 36 decimal, or "0x00000024" for the message, and xx's will have to be set based on what is required in Hex not decimal). You should be able to put a bunch of Take commands in one message as long as you set the Num of Takes and Byte Count properly and your message is not longer than 8176 bytes. At least ther is no checksum as far as I can tell!
  • mny_minemny_mine Posts: 5
    It Works !!!
    JasonS wrote: »
    Wow, this is a good one! How familiar with bit operations are you? I think the easiest way to deal with alot of this is going to be using long values, but you will have to do bit shifting inorder parse your groups of 4 bytes into long values. But that is if you want to fully implement the protocol. How much control over this matrix do you need? If you are just making a couple routes it will be easier to just figure ou those specific messages and can them. Without having a unit to play with here is what I think at a cursory look:


    0x0000000C - Router Control Protocol
    0x00000001 - Sequence Number
    0x00000024 - Byte Count (Totla Byte Count)
    0x00000050 - Take Command
    0x00000001 - Number of Takes in message
    -- Start of Take Data --
    0x000000xx - Level Number
    0x0000F000 - LPR ID (Fixed value indicating Generic 3rd Party control)
    0x000000xx - Source
    0x000000xx - Destination
    -- End of Take Data --
    -- End of Message --

    Yielding in AMX style:
    $00,$00,$00,$0C,$00,$00,$00,$01,$00,$00,$00,$24,$00,$00,$00,$50,$00,$00,
    $00,$01,$00,$00,$00,$xx,$00,$00,$F0,$00,$00,$00,$00,$xx,$00,$00,$00,$xx

    I think sequence number will have to change for every message, byte count will have to be set based on message length (this one would be 36 decimal, or "0x00000024" for the message, and xx's will have to be set based on what is required in Hex not decimal). You should be able to put a bunch of Take commands in one message as long as you set the Num of Takes and Byte Count properly and your message is not longer than 8176 bytes. At least ther is no checksum as far as I can tell!

    Hi Jason, you are my savior. The switching protocol works!!!!!!! I'm not that good with bit operation, still i will try to sort it out. I just need to control its routing as well as querying its current input status, in case operator did a manual switch from the unit itself.
  • JasonSJasonS Posts: 229
    I'm glad it worked! ITOHEX() will be your friend for debugging responses, you can use it on anything from a char up to a long. One of the things that will make this easier is to think of a char as an 8 bit integer, you can do math with it. If you are converting a value from a larger intrinsic type to a smaller intrinsic type, i.e. converting an integer to a char you will get compilier warnings, this is to remind you that you are losing information. You can suppress those warnings by type casting, or you can ignore them.
    DEFINE_VARIABLE
    
    integer i = 128
    char c
    
    DEFINE_START
    
    c = TYPE_CAST(i)
    

    Here is a function that will take 4 bytes and convert it to a long. Lsb = Least significant byte, NLsb = Next Least significant byte, NMsb = Next Most significant byte, Msb = Most significant byte.
    DEFINE_FUNCTION LONG Build_Word32(CHAR Lsb,  CHAR NLsb, CHAR NMsb, CHAR Msb)
    {
        RETURN (Lsb | NLsb << 8 | NMsb << 16 | Msb << 24)
    }
    

    But it looks like most of the time in this protocol you can deal directly with the Lsb. I have never tried putting a long value directly into a message, I'm not sure how it would format it. It might be worth a try. Let me know if I can help you with anything else.
  • mny_minemny_mine Posts: 5
    JasonS wrote: »
    I'm glad it worked! ITOHEX() will be your friend for debugging responses, you can use it on anything from a char up to a long. One of the things that will make this easier is to think of a char as an 8 bit integer, you can do math with it. If you are converting a value from a larger intrinsic type to a smaller intrinsic type, i.e. converting an integer to a char you will get compilier warnings, this is to remind you that you are losing information. You can suppress those warnings by type casting, or you can ignore them.
    DEFINE_VARIABLE
    
    integer i = 128
    char c
    
    DEFINE_START
    
    c = TYPE_CAST(i)
    

    Here is a function that will take 4 bytes and convert it to a long. Lsb = Least significant byte, NLsb = Next Least significant byte, NMsb = Next Most significant byte, Msb = Most significant byte.
    DEFINE_FUNCTION LONG Build_Word32(CHAR Lsb,  CHAR NLsb, CHAR NMsb, CHAR Msb)
    {
        RETURN (Lsb | NLsb << 8 | NMsb << 16 | Msb << 24)
    }
    

    But it looks like most of the time in this protocol you can deal directly with the Lsb. I have never tried putting a long value directly into a message, I'm not sure how it would format it. It might be worth a try. Let me know if I can help you with anything else.

    Thank you so much Jason, i'll try it out. You've been very helpful
Sign In or Register to comment.