Altera_Forum
Honored Contributor
17 years agoI2C on EPM570M100
Hi all,
I am trying to implement the I2C protocol (master side) on an EPM570 CPLD. I am new to VHDL so I am having trouble finding the errors of my code. Basically the code is working, I can see the communication using a scope. The problem is that the data that I get from the slave (AD7151 - Capacitance Converter for Proximity Sensing) doesn't match its spec - for example the 4 last bits of the 16-bit data register are supposed to be constantly '0' but they change all the time. I suspect that the problem is with the "read" packet (maybe timing or something) since the "write" packets work fine. I am using a 32.768kHz clock for the CPLD and the protocol uses the same clock divided by 2. The code is attached (some parts are irrelevant since I am posting only the communication implementation) Thanks a lot