Hi
I am trying change the I2C clock speed by following the instructions in past topic here:
http://forum.arduino.cc/index.php?topic=16793.0
As instructed, I have changed twi.h file, now found in:
..\arduino-1.5.2\hardware\arduino\avr\libraries\Wire\utility
I changed the definition line from:
#define TWI_FREQ 100000L
to
#define TWI_FREQ 400000L
However i can't find wire.o to delete. I saw in other forums that there are no more need for deleting .o files. In any case I measure the I2C clock speed using a scope and it doesn't change from the initial value of 10usec.
Any suggestions?
10x
Gil
check this I2C scanner - MultiSpeed I2C Scanner - 50,100,200,400 KHz. - Libraries - Arduino Forum -
you can adjust TWBR from within a sketch, is the easiest way AND you can use every IC on its max speed.
Thank you for the fast reply.
I now understand that I do not have TWBR definned, since I am using Arduino Due. The solution was to change another variable:
// TWI clock frequency
static const uint32_t TWI_CLOCK = 100000;
I found it under ..\arduino-1.5.6-r2\hardware\arduino\sam\libraries\Wire\Wire.h
Gil
Anyone know how i can make this same change in Arduino 1.6.4? I am running it on linux, have installed the SAM packages but cannot find it under ../arduino-1.6.4/hardware/arduino/sam
Hi I want to know if is the same for Arduino Nano because I did it and I couldn't compile twi
Thank You.
You don't need to do anything with the libraries. In setup(), assigned TWBR to one of the values in the following chart. I've had two Nanos, 328P chip, running at the max 888889bps.
CPU Freq 16000000
TWBR Eq. TWBR = ( ( CPU / I2C ) – 16 ) / 2
I2C Clock Eq. I2C = CPU / ( ( TWBR * 2 ) + 16 )
TWBR I2C Clock
0 no good 1000000
1 888888.888
888889
2 800000
8 500000
12 400000
17 320000
24 250000
32 200000
42 160000
56 125000
72 100000
152 50000
312 25000
792 10000