Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How hard is it to implement a 1984 "simple" hardware communication protocol?

How hard is it to implement a 1984 "simple" hardware communication protocol?

Scheduled Pinned Locked Moved The Lounge
hardwarequestion
36 Posts 12 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H honey the codewitch

    Well, I had the year wrong. Should have been 1983 - forgive my shoddy memory. 1983 was when they standardized the MIDI protocol. The reason it's relevant is simplicity. These were the days before stuff like Very Large Scale Integration in chip manufacturing, and solid state digital circuits were still pretty primitive so protocols had to be simple and of limited throughput.

    To err is human. Fortune favors the monsters.

    C Offline
    C Offline
    Calin Negru
    wrote on last edited by
    #15

    ok that`s legit. I have no further objections, I will only note that "hardware communication" and computers aren`t necessarely one and the same thing. MIDI does relate to computers but the case is at the edge of the mainstream IT (it`s not defining for IT "the beginnings") it rather belongs to the branch of music hardware. I have the impression that MIDI playback on PC as a thing belongs to the late 90`s (Age of Empires had MIDI playback I think).

    H 2 Replies Last reply
    0
    • C Calin Negru

      ok that`s legit. I have no further objections, I will only note that "hardware communication" and computers aren`t necessarely one and the same thing. MIDI does relate to computers but the case is at the edge of the mainstream IT (it`s not defining for IT "the beginnings") it rather belongs to the branch of music hardware. I have the impression that MIDI playback on PC as a thing belongs to the late 90`s (Age of Empires had MIDI playback I think).

      H Offline
      H Offline
      honey the codewitch
      wrote on last edited by
      #16

      I never mentioned computers. In fact, computers just complicate this because MIDI over USB can't do MIDI pass through devices

      To err is human. Fortune favors the monsters.

      C 1 Reply Last reply
      0
      • H honey the codewitch

        MIDI is a two wire serial protocol. It's a UART with a 5 pin DIN on the end. Literally I should be able to simply type Serial1.begin(31250); // MIDI baud rate And start talking to it. I've been through A USB host controller an ESP32 S2 an ESP32 S3 a MIDI breakout none of the hardware is giving me *anything* from MIDI, neither USB nor standard. I'm getting *another* MIDI breakout today. I hope the old one was defective. If that doesn't work I'm hardwiring a raw 5 pin DIN to an optocoupler and doing the whole elephanting thing from scratch. Nothing like waiting on hardware in order to code something you're pretty sure won't work.

        To err is human. Fortune favors the monsters.

        C Offline
        C Offline
        Cpichols
        wrote on last edited by
        #17

        It sounds super frustrating, but also irritatingly fascinating. I wonder if there are any books on the subject from the era. Will you write an article about all of this when you get it all figured out? I would love to read that.

        H 1 Reply Last reply
        0
        • C Cpichols

          It sounds super frustrating, but also irritatingly fascinating. I wonder if there are any books on the subject from the era. Will you write an article about all of this when you get it all figured out? I would love to read that.

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #18

          I fully intend to. I'm a little ways away from it now though. I have big plans. :)

          To err is human. Fortune favors the monsters.

          1 Reply Last reply
          0
          • C Calin Negru

            ok that`s legit. I have no further objections, I will only note that "hardware communication" and computers aren`t necessarely one and the same thing. MIDI does relate to computers but the case is at the edge of the mainstream IT (it`s not defining for IT "the beginnings") it rather belongs to the branch of music hardware. I have the impression that MIDI playback on PC as a thing belongs to the late 90`s (Age of Empires had MIDI playback I think).

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #19

            I'm replying here because your new comments are in moderation. This site is about programming, whether it's computers, or MCUs. In this case it's an MCU which acts as a MIDI controller. It is not a PC. It is little different than the circuitry you find in today's MIDI controllers. I am coding the firmware as well as building the hardware - they're both part of the very same project, so it is within the scope of CP. I have a substantial reputation for coding IoT here, and most folks in the lounge know me, so I didn't think it necessary to elaborate on all the details of what I was doing. This is simply part of the project. Edit: I should add, the lounge is for general commentary on the life of the people that post here. Lots of people post things that aren't code related. In fact that's probably 80% of the stuff here, if you count Wordle and such.

            To err is human. Fortune favors the monsters.

            1 Reply Last reply
            0
            • H honey the codewitch

              I never mentioned computers. In fact, computers just complicate this because MIDI over USB can't do MIDI pass through devices

              To err is human. Fortune favors the monsters.

              C Offline
              C Offline
              Calin Negru
              wrote on last edited by
              #20

              "hard" "music" this is site where posts usually have some bearing to computers/IT industry. So it is the "this is about computers" presumption that governs. When it`s not about computers express mention should be made that isn`t not about computers. When you use the word "hard" and start talking about music you move things in a totally different registry. That`s not something that can be made tacitly. The word "hardware" has one very clear meaning on this site, different from the one it might have on a music industry site. Is CP now suddenly a "rock and roll" website? that`s what it begins to look like if you neglect what I said above.

              1 Reply Last reply
              0
              • H honey the codewitch

                MIDI is a two wire serial protocol. It's a UART with a 5 pin DIN on the end. Literally I should be able to simply type Serial1.begin(31250); // MIDI baud rate And start talking to it. I've been through A USB host controller an ESP32 S2 an ESP32 S3 a MIDI breakout none of the hardware is giving me *anything* from MIDI, neither USB nor standard. I'm getting *another* MIDI breakout today. I hope the old one was defective. If that doesn't work I'm hardwiring a raw 5 pin DIN to an optocoupler and doing the whole elephanting thing from scratch. Nothing like waiting on hardware in order to code something you're pretty sure won't work.

                To err is human. Fortune favors the monsters.

                R Offline
                R Offline
                Ray Random
                wrote on last edited by
                #21

                Doesn't MIDI come in 5v and 3.3v? You might need a level shifter. E.g. ESP32 is 3.3v and won't appreciate 5v input.

                H 1 Reply Last reply
                0
                • R Ray Random

                  Doesn't MIDI come in 5v and 3.3v? You might need a level shifter. E.g. ESP32 is 3.3v and won't appreciate 5v input.

                  H Offline
                  H Offline
                  honey the codewitch
                  wrote on last edited by
                  #22

                  My module has a level shifter and can operate at either. I found the problem eventually. My TX and RX lines were crossed because I was confused about the orientation: I thought TX was labeled like "I go to the TX pin" rather than "I am the TX pin" - don't know where my head was at.

                  To err is human. Fortune favors the monsters.

                  T 1 Reply Last reply
                  0
                  • H honey the codewitch

                    MIDI to USB cable[^] There's no loop. It doesn't work like token ring if that's what you're saying. It's basically a simple UART with a 5 pin DIN. The *only* weird thing about it, is MIDI INs are always optocoupled (or otherwise physically decoupled) from the rest of the circuit to prevent ground loops (i think) - otherwise it's a simple 2 wire UART interface (not RS232, as there are no control lines, just TX and RX) - MIDI only uses like 2 or 3 of the five pins . i say maybe 2 because MIDI ins and outs require two separate lines. It is not full duplex at least not over one cable. I hope all that made sense, and answered whatever you were wondering about. I wasn't entirely clear on what you're talking about to be honest. :)

                    To err is human. Fortune favors the monsters.

                    J Offline
                    J Offline
                    JohnDG52
                    wrote on last edited by
                    #23

                    The "current loop" is an old standard (originally used for teletypes I believe), it is still used in many industrial apps, as it's good for noise rejection. Instead of using voltage (such as +/-12V) to communicate, it uses a 20mA on, 4mA off signal. The receiver has a resistor that the current flows through, so it can monitor the current by measuring the voltage. The 4mA off state is used so that no current indicates a broken wire. The standard is also used for sending analog values from sensors. Sorry for the rambling mansplainage.

                    H 1 Reply Last reply
                    0
                    • J JohnDG52

                      The "current loop" is an old standard (originally used for teletypes I believe), it is still used in many industrial apps, as it's good for noise rejection. Instead of using voltage (such as +/-12V) to communicate, it uses a 20mA on, 4mA off signal. The receiver has a resistor that the current flows through, so it can monitor the current by measuring the voltage. The 4mA off state is used so that no current indicates a broken wire. The standard is also used for sending analog values from sensors. Sorry for the rambling mansplainage.

                      H Offline
                      H Offline
                      honey the codewitch
                      wrote on last edited by
                      #24

                      Ah, thanks for the explanation. MIDI is just simple UART. In fact, care is taken to avoid ground loops that can transfer noise or hum from one piece of equipment to the next, which means by the standard, MIDI In ports are always optocoupled (or equivalent). They aren't in a ring, either. The cables are half-duplex UART meaning one cable carries either RX or TX depending if it's an In or Out port it's plugged into. Weirdly, they use 5 pin DIN to connect. My guess is the physically large connector is good for stage equipment for a number of reasons.

                      To err is human. Fortune favors the monsters.

                      J 1 Reply Last reply
                      0
                      • H honey the codewitch

                        MIDI is a two wire serial protocol. It's a UART with a 5 pin DIN on the end. Literally I should be able to simply type Serial1.begin(31250); // MIDI baud rate And start talking to it. I've been through A USB host controller an ESP32 S2 an ESP32 S3 a MIDI breakout none of the hardware is giving me *anything* from MIDI, neither USB nor standard. I'm getting *another* MIDI breakout today. I hope the old one was defective. If that doesn't work I'm hardwiring a raw 5 pin DIN to an optocoupler and doing the whole elephanting thing from scratch. Nothing like waiting on hardware in order to code something you're pretty sure won't work.

                        To err is human. Fortune favors the monsters.

                        S Offline
                        S Offline
                        Snorri Kristjansson
                        wrote on last edited by
                        #25

                        I did build my own MIDI card for the IBM PC ISA bus in the 80's. The main difference between MIDI and RS232 serial comms is the baud rate needed. I used a 2MHz crystal for the MIDI. RS232 uses 1.8something MHz crystal. The reason is that the baud rate needed for MIDI is not possible otherwise.

                        H 1 Reply Last reply
                        0
                        • S Snorri Kristjansson

                          I did build my own MIDI card for the IBM PC ISA bus in the 80's. The main difference between MIDI and RS232 serial comms is the baud rate needed. I used a 2MHz crystal for the MIDI. RS232 uses 1.8something MHz crystal. The reason is that the baud rate needed for MIDI is not possible otherwise.

                          H Offline
                          H Offline
                          honey the codewitch
                          wrote on last edited by
                          #26

                          Ah, yeah, because it's not divisible, I get you. In this it's not a problem, as the timing completely configurable via this little ESP32 MCU. They're little beasts.

                          To err is human. Fortune favors the monsters.

                          1 Reply Last reply
                          0
                          • H honey the codewitch

                            Ah, thanks for the explanation. MIDI is just simple UART. In fact, care is taken to avoid ground loops that can transfer noise or hum from one piece of equipment to the next, which means by the standard, MIDI In ports are always optocoupled (or equivalent). They aren't in a ring, either. The cables are half-duplex UART meaning one cable carries either RX or TX depending if it's an In or Out port it's plugged into. Weirdly, they use 5 pin DIN to connect. My guess is the physically large connector is good for stage equipment for a number of reasons.

                            To err is human. Fortune favors the monsters.

                            J Offline
                            J Offline
                            JohnDG52
                            wrote on last edited by
                            #27

                            5 pin DIN is a puzzlement, especially as XLRs are more robust, easier to connect and more prevalent in performance situations.

                            H 1 Reply Last reply
                            0
                            • J JohnDG52

                              5 pin DIN is a puzzlement, especially as XLRs are more robust, easier to connect and more prevalent in performance situations.

                              H Offline
                              H Offline
                              honey the codewitch
                              wrote on last edited by
                              #28

                              I know why they didn't use XLR. XLR is already used for microphones. They don't want to make it so you can insert cables into slots that can damage equipment. You wouldn't want to run MIDI into an XLR with phantom power for example. You might blow up your synth. Remember this stuff is made for musicians who may not be very technical otherwise. :)

                              To err is human. Fortune favors the monsters.

                              J 1 Reply Last reply
                              0
                              • H honey the codewitch

                                MIDI to USB cable[^] There's no loop. It doesn't work like token ring if that's what you're saying. It's basically a simple UART with a 5 pin DIN. The *only* weird thing about it, is MIDI INs are always optocoupled (or otherwise physically decoupled) from the rest of the circuit to prevent ground loops (i think) - otherwise it's a simple 2 wire UART interface (not RS232, as there are no control lines, just TX and RX) - MIDI only uses like 2 or 3 of the five pins . i say maybe 2 because MIDI ins and outs require two separate lines. It is not full duplex at least not over one cable. I hope all that made sense, and answered whatever you were wondering about. I wasn't entirely clear on what you're talking about to be honest. :)

                                To err is human. Fortune favors the monsters.

                                M Offline
                                M Offline
                                Matthew Barnett
                                wrote on last edited by
                                #29

                                I'm looking at the spec. and I don't see TX and RX. It's either MIDI IN or MIDI OUT, so the connection is unidirectional, and it uses a balanced pair at 5V.

                                H 1 Reply Last reply
                                0
                                • M Matthew Barnett

                                  I'm looking at the spec. and I don't see TX and RX. It's either MIDI IN or MIDI OUT, so the connection is unidirectional, and it uses a balanced pair at 5V.

                                  H Offline
                                  H Offline
                                  honey the codewitch
                                  wrote on last edited by
                                  #30

                                  You won't see it in the spec, as the spec doesn't actually say it's a UART. In practice it is. The data line is either your TX line or your RX line depending if it's In or Out (each cable deals with only one of them) It operates at 31250 baud. In any case I got it working. I had my TX and RX lines crossed like I said.

                                  To err is human. Fortune favors the monsters.

                                  M 1 Reply Last reply
                                  0
                                  • H honey the codewitch

                                    I know why they didn't use XLR. XLR is already used for microphones. They don't want to make it so you can insert cables into slots that can damage equipment. You wouldn't want to run MIDI into an XLR with phantom power for example. You might blow up your synth. Remember this stuff is made for musicians who may not be very technical otherwise. :)

                                    To err is human. Fortune favors the monsters.

                                    J Offline
                                    J Offline
                                    JohnDG52
                                    wrote on last edited by
                                    #31

                                    Yeabut mic connectors are 3-pin. MIDI uses 5 pins. XLR connectors are also used for DMX (lighting) cables. Other XLR pincounts are available (obvs), plus colour-coding rings. A stage set-up for a big performance will have hundreds of assorted XLR cables, I just reckon someone missed a trick when creating the MIDI standard.

                                    1 Reply Last reply
                                    0
                                    • H honey the codewitch

                                      You won't see it in the spec, as the spec doesn't actually say it's a UART. In practice it is. The data line is either your TX line or your RX line depending if it's In or Out (each cable deals with only one of them) It operates at 31250 baud. In any case I got it working. I had my TX and RX lines crossed like I said.

                                      To err is human. Fortune favors the monsters.

                                      M Offline
                                      M Offline
                                      Matthew Barnett
                                      wrote on last edited by
                                      #32

                                      Well, all I can say is that the spec. I'm looking at does say UART!

                                      H 1 Reply Last reply
                                      0
                                      • M Matthew Barnett

                                        Well, all I can say is that the spec. I'm looking at does say UART!

                                        H Offline
                                        H Offline
                                        honey the codewitch
                                        wrote on last edited by
                                        #33

                                        Well, fair enough

                                        To err is human. Fortune favors the monsters.

                                        1 Reply Last reply
                                        0
                                        • H honey the codewitch

                                          My module has a level shifter and can operate at either. I found the problem eventually. My TX and RX lines were crossed because I was confused about the orientation: I thought TX was labeled like "I go to the TX pin" rather than "I am the TX pin" - don't know where my head was at.

                                          To err is human. Fortune favors the monsters.

                                          T Offline
                                          T Offline
                                          Tiger12506
                                          wrote on last edited by
                                          #34

                                          Hardware pins are always labeled from the perspective of the chip they are attached to. If a pin says TX, it means *this chip* right here transmits on this pin, and if you want to communicate between two chips, you connect one's TX to the other's RX. I know you know all this, HTCW, so just for the benefit of someone else who might not... Any hardware you find that doesn't follow this convention should be shunned and the designer publicly shamed in the town square -- but I think it's pretty rare overall.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups