๐Ÿ“ฃ๐Ÿ“ช ๐Ÿšš Adafruit will not be shipping USPS orders Monday January 20, 2020 ๐Ÿ—“. Expedited USPS orders placed after 11am ET ๐Ÿ•š Friday January 17 will go out Tuesday January 21 ๐Ÿ“ฃ๐Ÿ“ช๐Ÿšš
0

change i2c speed on metro m4 express
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

change i2c speed on metro m4 express

by dheijl on Tue Jul 16, 2019 7:44 am

Hi,

I use the Metro M4 Express to control stepper motors with Motor Shields V2, using the Arduino IDE. I like those SAMD51 boards!
But... I need to increase the i2c speed.
The recommended change in the docs is for Atmel based boards only, and I can't find the equivalent for the SAMD51 boards (I don't want to change the SAMD51 twi code).
So, I would need the SAMD51 equivalent of:
Code: Select all | TOGGLE FULL SIZE
TWBR = ((CPU_FREQ / 400000L) - 16) / 2;

Thanks!

dheijl
 
Posts: 3
Joined: Tue Jul 16, 2019 7:34 am

Re: change i2c speed on metro m4 express

by dheijl on Tue Jul 16, 2019 9:01 am

To answer my own question: after looking at the library source code I noticed that the i2c used by the M4 Metro is Wire.
So the following line does the trick to get a higher RPM out of the steppers:
Code: Select all | TOGGLE FULL SIZE
Wire.setSpeed(400000);

dheijl
 
Posts: 3
Joined: Tue Jul 16, 2019 7:34 am

Re: change i2c speed on metro m4 express

by dheijl on Tue Jul 16, 2019 12:09 pm

The motor shield also support "fast plus" i2c speed (1000000) because the PCA9685 chip does.

dheijl
 
Posts: 3
Joined: Tue Jul 16, 2019 7:34 am

Please be positive and constructive with your questions and comments.