I am attempting to use the Vega's integrated I2C port without success.
I have tried using the supplied library (stpckit/src/libreg/i2cvega), but I get no response from the processor. I strongly doubt that I am actually accessing the Vega I2C registers properly - the register defaults have no resemblance to the register defaults shown in the programming manual. For instance, unsigned long reg; HWI2C_Init(); reg = HWI2C_ReadReg(HWI2C_REG_CLOCK); gives a value of 0xffffffff. I am using the evaluation board with a Vega marked STPCV1JEBC which I assume is mature enough to have a working I2C. Has anyone used the Vega's I2C?. If so, could you please supply a snippet of working example code? Thanks.
Thanks for your response. I would just like to verify that you are not using the I2C emulator from the STPCKIT that uses GPIO to emulate I2C, but are in fact using the I2C integrated into the VEGA processor. If you are using the integrated I2C, would you be willing to show me a couple of snippets of your code, specifically the initialization and an example of reading from the I2C? I am also working at a low level (no OS). Thanks for any help you can give, Harold
Yes we used veag's i2C and it works without problem. Are you using the last version of vega programming manual? I will try to send you an example code.
It has turned out that my problem is with the initialization, specifically setting up the base address for the Host interface that is used by the I2C. I was using the initialization provided by the STPCKIT SDK, which turns out to be incorrect. As per the programming manual (section 3.8), the least significant byte of the host base address must be ored with 0x03 when it is written to Host interface configuration address 0x12 - this is not done in the SDK (as of version 2.1). When I made this fix, I was able to access the I2C registers. I urge the SDK people to make this fix in future versions of the SDK. Harold
You assume that in the STPCKIT V2.1 you have changed the HWI2C_BASE_LSB parmater to HWI2C_BASE_LSB ||0x03 when writing in the Host configuration register 0x12 ? We will check this point and return to you to confirm. Thanks.