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.
Asked
Active
Viewed 131 times
0
-
The FPGA code is 10M50DAF484C7G – Lucca Machado Jul 09 '22 at 20:51
-
1See the [I2C Specification](https://www.nxp.com/docs/en/user-guide/UM10204.pdf). The clock is not continuous and can be the output of a state machine. – user16145658 Jul 10 '22 at 07: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. – Harry Jul 10 '22 at 20:25
2 Answers
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.
-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

daohu527
- 452
- 4
- 15
-
-
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 – daohu527 Jul 11 '22 at 00:57
-
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 – Lucca Machado Jul 11 '22 at 17:56