Wicked Minds Electronics Posted May 16, 2012 Report Share Posted May 16, 2012 My design only requires me to perform some I2C writes to initialize a couple of devices. After trying several different methods and being new to FPGA in general I found that this solution was even simpler than implementing PicoBlaze.CustomizingTo define the I2C writes performed look inside SimpleI2CCore.vhd where you will find an array called seq:constant seq: seqT:= (-- RESET CAM(idle, x"00"),(start, x"00"),(const, TCM_DEV_ADDR & '0'),(const, TCM_REG_SLEEP),(const, TCM_SOFT_RESET),(stop, x"00"),...(start, x"00"),(const, VIDEO_ENCODER_ADDR & '0'),(const, VIDEO_CONTROL_5),(const, x"60"),(stop, x"00"),-- end(idle, x"00"));Change the const values to the appropriate ones for your device(s). In the attached project there are several writes defined for two different devices, you can remove/add as many as you like just always ensure your last value is idle so that it releases the SCL and SDA lines. Also note the device address constants are 7 bits.Remember to modify the top boundary of the array here:type seqT is array(0 to 41) of i2cT;With a 24Mhz input clock, it produces a 100KHz I2C clock. The additional DCM in the attached project that provides 27MHz is only to drive the external I2C devices and can be removed or modified as needed.Live output from Papilio:Hopefully others will find this as useful as I did This post has been promoted to an articleSimpleI2C.zip Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.