0

I am doing a university project in which i have to build a I2C which have only one slave and will have to transmit a data with 5 bits, 4 bits for the number which is in the range of 0 to 9 and 1 bit to read or write, i'm using a DE10-LITE with VHDL for this project, which has a 50 Mhz default clock, i was looking into the "ALTPLL" inside quartus prime but i can't find the option to set my clock to 100kbps, i did find in the in some forums that the "Set up PLL in LVDS mode" enables that, but for some reason quartus won't let me activate it. My SDA will be 100kbps, and the SCL 50mhz.

3
  • The FPGA code is 10M50DAF484C7G Commented Jul 9, 2022 at 20:51
  • 1
    See the I2C Specification. The clock is not continuous and can be the output of a state machine. Commented Jul 10, 2022 at 7:33
  • This clock is very slow, so you don't need to use a PLL to generate it. If your FPGA clock is a multiple of 100 kHz, then you can easily generate the I2C clock with simple clock-divider logic. Commented Jul 10, 2022 at 20:25

2 Answers 2

0

As the Other people have said: You don't need a PLL for that. If you already have a default clock of 50MHz then you just need to divide that by 500, using a counter, and then you have your 100kHz clock.

Anyways, you would want to start the counter only when there is a request on the bus. So user16145658 is correct: The generated clock should be the output of your state machine.

Sign up to request clarification or add additional context in comments.

Comments

-1

You don't need to change the clock of the FPGA, since you are using an FPGA, you only need to implement an i2c core to communicate with the i2c device.

And the i2c specification specifies the rate of i2c

Standard mode (Sm) 100 kbit/s
Fast mode (Fm) 400 kbit/s

3 Comments

This doesn't answer the question (how to generate the clock).
Normally i2c core will provide clock and bus logic, such as frequency division of FPGA clock, these are all implemented in i2c core, I can't remember the details.And i2c core is very common, similar to calling c++ library functions, if you want to know the details, you can download and view the implementation of i2c core
My question was about the code itself, i understand the concept, but i'm confused of how i'm supposed to transmit data at that rate

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.