0
\$\begingroup\$

Hello I will be communicating with a device using SMBus. For this, I will be using PIC18F26K83. Timing is not important for me so I m somehow free to choose any clock frequency for my MCU. Well higher, better of course. I am new to PIC so I am confused by the datasheet. I want to have I2C clock between 10 kHz and 100 kHz . (I added the picture of related register.)

  1. In this case what is the best configuration for I2CxCLK register? (Timing is not that crucial for MCU.)
  2. In datasheet it says I can set I2C clock to HFINTOSC and MFINTOSC. However, again datasheet says (in oscillator selection part) HFINTOSC can be 1,2,4,8,12,16,32,48,64 MHz Oscillator and MFINTOSC can be 31.25 kHz and 500 kHz Oscillator. What does that mean? Which value I2C clock takes when I choose HFINTOSC or MFINTOSC for it?
  3. If I have 250 kHz MCU clock, if I choose I2C to be FOSC/4, in that case will it be 62.5 kHz?
  4. Last question is can MCU clock and I2C clock be same? Would it be a problem. I ask it because in UART I remember something like: MCU freq. should be 16 times bigger than UART baudrate.

I2CxCLK register

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I'm working with PIC24 but I can try to help you.

  1. It depends on your system, you can choose any clock source to fit your requirements (10kHz-100kHz).You can use Fosc if you use a core frequency in the desired range, or Fosc/4 if needed, you can also use the timers (TMR0/2/4/6) if they run at the right frequency.
  2. MFINTOSC provides two clocks (500kHz and 31.25kHz), but only the 500kHz seems to be mapped to the I2C peripheral. For HFINTOSC, you need to set the register OSCFRQ, but the minimum frequency is 1MHz (not in your requirements).
  3. Yes.
  4. I think it will work with the same clock as the MCU. I2C peripheral can use Fosc clock without dividing it by 16 (not as the UART).
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.