change i2c speed on metro m4 express

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dheijl
 
Posts: 3
Joined: Tue Jul 16, 2019 7:34 am

change i2c speed on metro m4 express

Post by dheijl »

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

TWBR = ((CPU_FREQ / 400000L) - 16) / 2;
Thanks!

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

Re: change i2c speed on metro m4 express

Post by dheijl »

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

Wire.setSpeed(400000);

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

Re: change i2c speed on metro m4 express

Post by dheijl »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”