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 18 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 Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    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.

    M OriginalGriffO C 0 C 8 Replies 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.

      M Offline
      M Offline
      Mircea Neacsu
      wrote on last edited by
      #2

      With the caveats that I know very little about ESP32 and even less about MIDI, are you sure the baud rate generator can make such a strange baud rate? I'd hookup a scope and send a series of 'U' (0x55) to see the effective baud rate. Not long ago I had trouble with a device that wanted 125000 baud rate. Just my 0.02$

      Mircea

      H 1 Reply Last reply
      0
      • M Mircea Neacsu

        With the caveats that I know very little about ESP32 and even less about MIDI, are you sure the baud rate generator can make such a strange baud rate? I'd hookup a scope and send a series of 'U' (0x55) to see the effective baud rate. Not long ago I had trouble with a device that wanted 125000 baud rate. Just my 0.02$

        Mircea

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

        It's the MIDI standard. A) It's what the spec says B) I have reference code - multiple projects by different authors actually, that use this baud rate C) I'd be getting garbage instead of nothing But yeah, thanks. :)

        To err is human. Fortune favors the monsters.

        M 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.

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Flow control lines (RTS/CTS, DTR/DSR)? It's worth pinning them permanently high just to be on the safe side.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          H 1 Reply Last reply
          0
          • H honey the codewitch

            It's the MIDI standard. A) It's what the spec says B) I have reference code - multiple projects by different authors actually, that use this baud rate C) I'd be getting garbage instead of nothing But yeah, thanks. :)

            To err is human. Fortune favors the monsters.

            M Offline
            M Offline
            Mircea Neacsu
            wrote on last edited by
            #5

            Please don't take it as mansplaining :)

            honey the codewitch wrote:

            A) It's what the spec says

            If you are referring to MIDI baud rate, we both agree on that.

            honey the codewitch wrote:

            B) I have reference code - multiple projects by different authors actually, that use this baud rate

            Are they on ESP32? A quick search on available baud rate for ESP32 didn't give any definitive results. Not all baud rates can be obtained from an oscillator. See this list of oscillator frequencies and search for "UART" in it. On the transmitter side, the frequency is divided by an integer number to generate the baud rate. On the receiving side, the oscillator frequency is divided to a multiple of the baud rate (x8 or x16) and, after the initial high to low transition of the start bit, successive bits are sampled in the middle. If divided frequency doesn't match the baud rate, the last bits will be sampled improperly. (yes, this part smells of mansplaining :) ) The MIDI baud rate is a divisor of 1MHz while most communication baud rates are multiples of the original 75 bauds teletype rate.

            honey the codewitch wrote:

            C) I'd be getting garbage instead of nothing

            Are you referring to my suggestion of sending a repetitive character? This is just a test to see you have the correct baud rate. You don't need to have anything connected to the transmitter.

            Mircea

            H 1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              Flow control lines (RTS/CTS, DTR/DSR)? It's worth pinning them permanently high just to be on the safe side.

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

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

              This isn't RS232, it's just a simple UART. There is only TX and RX.

              To err is human. Fortune favors the monsters.

              1 Reply Last reply
              0
              • M Mircea Neacsu

                Please don't take it as mansplaining :)

                honey the codewitch wrote:

                A) It's what the spec says

                If you are referring to MIDI baud rate, we both agree on that.

                honey the codewitch wrote:

                B) I have reference code - multiple projects by different authors actually, that use this baud rate

                Are they on ESP32? A quick search on available baud rate for ESP32 didn't give any definitive results. Not all baud rates can be obtained from an oscillator. See this list of oscillator frequencies and search for "UART" in it. On the transmitter side, the frequency is divided by an integer number to generate the baud rate. On the receiving side, the oscillator frequency is divided to a multiple of the baud rate (x8 or x16) and, after the initial high to low transition of the start bit, successive bits are sampled in the middle. If divided frequency doesn't match the baud rate, the last bits will be sampled improperly. (yes, this part smells of mansplaining :) ) The MIDI baud rate is a divisor of 1MHz while most communication baud rates are multiples of the original 75 bauds teletype rate.

                honey the codewitch wrote:

                C) I'd be getting garbage instead of nothing

                Are you referring to my suggestion of sending a repetitive character? This is just a test to see you have the correct baud rate. You don't need to have anything connected to the transmitter.

                Mircea

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

                The baud rate on the ESP32 end is configurable and must match the baud rate of MIDI

                Mircea Neacsu wrote:

                The MIDI baud rate is a divisor of 1MHz while most communication baud rates are multiples of the original 75 bauds teletype rate.

                That's interesting, and if the reference code did not exist (some of it is for the ESP32, some for Arduino, I've tried both) I'd be really concerned by that. As it is, there are known goods that are doing what I'm doing. I suspect a bad module, so I've ordered a different, simpler module and hopefully that will work.

                To err is human. Fortune favors the monsters.

                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
                  Calin Negru
                  wrote on last edited by
                  #8

                  Hey HTCW that seems like a rather basic and general question. Does the "processor powerhouse" have trouble recalling one it`s fundamental lessons or that`s actually an exotic question but I fail to see the subtility. what`s so special about 1984 why not 1985, 2000 or some other year?

                  H 1 Reply Last reply
                  0
                  • C Calin Negru

                    Hey HTCW that seems like a rather basic and general question. Does the "processor powerhouse" have trouble recalling one it`s fundamental lessons or that`s actually an exotic question but I fail to see the subtility. what`s so special about 1984 why not 1985, 2000 or some other year?

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

                    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 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.

                      0 Offline
                      0 Offline
                      0x01AA
                      wrote on last edited by
                      #10

                      What happens if you connect the midi out directly with the midi in (loopback or however one call this)?

                      H 1 Reply Last reply
                      0
                      • 0 0x01AA

                        What happens if you connect the midi out directly with the midi in (loopback or however one call this)?

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

                        I don't send MIDI out with this device yet, so I can't check that. I did however, connect the keyboard to the computer successfully using MIDI DINs to USB so I know the keyboard is good. I think I have narrowed it down in this case to a hardware problem. I think my previous problems were software, but as it usually goes with the most vexing troubleshooting, I was probably dealing with issues on multiple fronts. I have a replacement piece of hardware coming today and we'll see how that goes. It's even simpler than the module I currently have, and should eliminate some variables from the equation if nothing else. It's also smaller and not one of those insipid Arduino shields I hate so much.

                        To err is human. Fortune favors the monsters.

                        0 1 Reply Last reply
                        0
                        • H honey the codewitch

                          I don't send MIDI out with this device yet, so I can't check that. I did however, connect the keyboard to the computer successfully using MIDI DINs to USB so I know the keyboard is good. I think I have narrowed it down in this case to a hardware problem. I think my previous problems were software, but as it usually goes with the most vexing troubleshooting, I was probably dealing with issues on multiple fronts. I have a replacement piece of hardware coming today and we'll see how that goes. It's even simpler than the module I currently have, and should eliminate some variables from the equation if nothing else. It's also smaller and not one of those insipid Arduino shields I hate so much.

                          To err is human. Fortune favors the monsters.

                          0 Offline
                          0 Offline
                          0x01AA
                          wrote on last edited by
                          #12

                          Quote:

                          connect the keyboard to the computer successfully using MIDI DINs to USB

                          Ok, but also that sounds strange for me. What I thought is, that MIDI is 5mA current loop...

                          H 1 Reply Last reply
                          0
                          • 0 0x01AA

                            Quote:

                            connect the keyboard to the computer successfully using MIDI DINs to USB

                            Ok, but also that sounds strange for me. What I thought is, that MIDI is 5mA current loop...

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

                            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.

                            0 J M 3 Replies 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.

                              0 Offline
                              0 Offline
                              0x01AA
                              wrote on last edited by
                              #14

                              Thank you for your explanations! The only expirience I have with MIDI is to connect my drums to the sound mixer :-O :laugh:

                              1 Reply Last reply
                              0
                              • 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
                                          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