I am trying to do some experiments to see how fast I can send data over an I2C line and still get reliable communications. According to the TRM I should be able to set the bit rate for the hardware I2C systems up to 1 Mhz using FM+. I have an logic analyzer hooked up to monitor the output of the some of the I2C lines. Specifically IC2-1 and IC2-4. I generated out the tegra123-pm375.dts from the dtb file on the jetson and saw that these settings for IC2-1 and IC2-4:
i2c@7000c400 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "nvidia,tegra124-i2c";
reg = <0x7000c400 0x100>;
interrupts = <0x0 0x54 0x4>;
scl-gpio = <0x8 0x9d 0x0>;
sda-gpio = <0x8 0x9e 0x0>;
nvidia,memory-clients = <0xe>;
status = "okay";
clock-frequency = <0x186a0>;
};
…
i2c@7000d000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "nvidia,tegra124-i2c";
reg = <0x7000d000 0x100>;
interrupts = <0x0 0x35 0x4>;
nvidia,require-cldvfs-clock;
scl-gpio = <0x8 0xce 0x0>;
sda-gpio = <0x8 0xcf 0x0>;
nvidia,memory-clients = <0xe>;
status = "okay";
clock-frequency = <0x61a80>;
nvidia,bit-banging-xfer-after-shutdown;
};
The clock frequency for IC2-1 is set to 0x186a0=100000, and for IC2-4 it is 0x61a80=400000. I am opening up these ports and sending out a byte of data and measuring the time between clock pulses on the logic analyzer.
…
if ((deviceHandle = open(“/dev/i2c-1”, O_RDWR)) < 0) {
printf(“Error: Couldn’t open device! %d\n”, deviceHandle);
return 1;
}
// connect to arduino as i2c slave
if (ioctl(deviceHandle, I2C_SLAVE, deviceI2CAddress) < 0) {
printf("Error: Couldn't find arduino on address!\n");
return 1;
}
// begin transmission and request acknowledgement
readBytes = write(deviceHandle, buffer, 1);
…
When I measure the signal sent for both IC2-1 and IC2-4 they both match the set clock frequency in the dtb file. So I tried changing the frequency. At first I tried setting IC2-1 to be 400Khz. I regenerated the dtb file, rebooted and tried again, but I still got 100Khz. I then tried a couple of other changes, but nothing I do seems to change the frequency. I am still learning how to get around in linux, so it is entirely possible I am misunderstanding something here, but I thought the DTB was where you configured things like the bitrate of the I2C bus? Does anyone have any pointers on what I am doing wrong, because I am a bit stumped?
Thanks