i2c Baud Rate
-
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
-
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.
-
@__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.
-
@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.
-
@__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?
-
@bearer Thank you, and I hope both of you forgive my ignorance.
-
Its not ignorance when you learn from it, then its education
-
@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 0xFFThe 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.
-
@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.
-
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.