Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    i2c Baud Rate

    Scheduled Pinned Locked Moved Solved
    General Discussion
    3
    10
    1.6k
    Loading More Posts
    • 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.
    • __sjm__undefined
      __sjm__
      last edited by

      After looking at baud rate configuration and a few posts about i2c, like this one, I'm still having a communication issue.

      I have connected a 3-axis magnetometer with my Duet [FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 2.04RC2 ELECTRONICS: Duet WiFi 1.02 or later FIRMWARE_DATE: 2019-08-05b1]. I have connected them through TWD0 and TWCK0 pins, using i2c. The baud rate for the magnetometer is 9600. The buad rate for the Duet is 57600.

      I don't seem able to change the baud rate with the M575. Using M575 P1, I could change the baud on PanelDue , but it doesn't seem to support i2c.

      Is there an i2c port on the Duet that permits a change in baud rate?

      Thank you for your time, in advance. sjm

      A Former User? 2 Replies Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators
        last edited by

        I2C doesn't use a baud rate, it uses a clock rate. RRF uses 100kHz, which is fairly standard. Some devices can go up to 400kHz or higher. I've never heard of anything using a clock speed as low as 9.6kHz.

        Page 23 of the datasheet that you linked to says that the magnetometer will work at up to 100kHz in standard mode, or 400kHz in fast mode. So it should work with the 100kHz speed used by the Duet + RRF.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        __sjm__undefined 1 Reply Last reply Reply Quote 1
        • A Former User?
          A Former User @__sjm__
          last edited by

          @__sjm__ said in i2c Baud Rate:

          Is there an i2c port on the Duet that permits a change in baud rate?

          nope, and you'd generally refer to i2c in terms of clock rate, speed or even just standard, full and fast speed leaving baud for more uart and modem specific things although the term isn't technically incorrect.

          __sjm__undefined 1 Reply Last reply Reply Quote 1
          • __sjm__undefined
            __sjm__ @dc42
            last edited by

            @dc42 According to my o-scope capture of the clock and data lines, the frequency is on the order of 90.91 kHz. So, we know the hardware is operating withing a sane environment.

            1 Reply Last reply Reply Quote 0
            • A Former User?
              A Former User @__sjm__
              last edited by

              @__sjm__ said in i2c Baud Rate:

              he baud rate for the magnetometer is 9600.

              @__sjm__ said in i2c Baud Rate:

              According to my o-scope capture of the clock and data lines, the frequency is on the order of 90.91 kHz.

              sounds like you've got something mixed up along the way?

              1 Reply Last reply Reply Quote 0
              • __sjm__undefined
                __sjm__ @A Former User
                last edited by

                @bearer Thank you, and I hope both of you forgive my ignorance.

                1 Reply Last reply Reply Quote 0
                • A Former User?
                  A Former User
                  last edited by

                  Its not ignorance when you learn from it, then its education 😉

                  1 Reply Last reply Reply Quote 1
                  • __sjm__undefined
                    __sjm__
                    last edited by

                    @dc42 , @bearer I was hoping the clock rate was the issue, here.

                    M260 A"0x0C" B"0x00" R7
                    

                    and

                    M260 A"0x0C" B"0x4E" R7
                    

                    return the same values:
                    0x03 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF

                    The address (0x0C) is correct: it is the default address in the datasheet, and I get errors when I use something else.

                    B"0x00" is trash, B"0x4E" is a simple read request. Both yield the same "0x03 0xFF....". An explanation is the some configuration is off, and the tail end of the address is being interpreted as the same command. That explanation doesn't make sense, given that the frequency seems to be working as expected.

                    1 Reply Last reply Reply Quote 0
                    • __sjm__undefined
                      __sjm__
                      last edited by

                      @dc42 , @bearer Here was my mistake:

                      To configure the magnetometer, I sent

                      M260 A"0x0C" B"0x60:0x00:0x5C:00" R1
                      

                      which is nonsense to the firmware.

                      I stopped using the array of hex values and instead (correctly) used an array of decimal values :

                      M260 A12 B96:0:92:0 R1
                      

                      Things started working. Thank you, both.

                      dc42undefined 1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @__sjm__
                        last edited by

                        I'm glad you got it working. Using hex values might work if you put quotation marks around each one one individually, but I haven't checked this.

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA