Need I2C Driver

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
User avatar
VLSI Staff
Posts: 2649
Joined: Tue 2010-06-22 13:43

Re: Need I2C Driver

Post by Panu » Sat 2018-07-14 12:41

your post above seems to imply that only GPIO1 pins have the engine. Am I reading this correctly?
No, la... all GPIO controllers are similar, and all three GPIO controllers have a dual bit engine.
There's a header file, i2cp2.h which defines the IO pin mappings. The code assumes that they are GPIO1 pins, because the code uses the bit router engine in the peripheral controller to make very efficient code. If you want to use GPIO2 pins instead (as I suppose you want), you'll have to change the rest of the code to access GPIO2 controller registers instead of GPIO1 controller.
What I said, or tried to say anyway, was that there are pin definitions in the .h file. But if you want to use pins in other controller than GPIO1, then just changing those #defines is not enough, you need to touch the code in the .c file also, because the code (.c file) only thinks that GPIO1 controller is used, e.g. it reads and writes only GPIO1 controller registers.

The bit engine is used to make the code very small, because the bit engine handles shifting the bits to the correct position, so the code just needs to shift-or in a loop to get the bytes. Normal GPIO control registers are used to switch between input and output modes for the SDA bit.

Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply