Jump to content
  • 0

Chipkit uC32 change I2C speed


ryanpandey

Question

Hello. I'm trying to change the speed of the I2C bus from the default (I think 100kHz) to 1.7MHz. In which file do I change the speed?

I found the following in DTWI.cpp (lines 136 - 141):

    // put a default of 100KHz
    // use F_CPU because __PIC32_pbClk is not set up yet
    // as constructor run before MPIDE Init; however, this would be the correct
    // value at this point as noone has the chance to change the clock freq
    // later we can use __PIC32_pbClk; which is used in masterStart
    ptwi->ixBrg.reg = (F_CPU/FQ100KHz/2) - (((F_CPU / 10000000) * 26) / 25) - 2;

 

Changing the 10000000 to a 40000000 (for 400kHz speed) did not seem to change the I2C bus speed. Is there another place the change needs to be made? Thanks.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...