I'm trying to interface an HMC5883L 3-Axis Compass Module to the TWI Controller Module of a BF537 EZ Kit Lite board. The compass module makes use of an I2C serial bus standard for interfacing. This is how I came about the TWI on the BF537 board. I have already read through the Reference Manual about the module. But, I'm fairly new with Blackfin processors and am really not sure how to start.
I found the TWI sample program in the ezVideoSensor_EZ_A-V_Extender project in the installation folder, and have tried constructing my code based from it (I am to use C Language). I tried the program on the board together with the compass module, but it did not work the way I expected it to. Assuming that the compass setup I constructed was correct, I would like to get you opinion with regards to my program. For the program as well, I am not that confident about my Read function working as I had based it only from the given Write function in the example. Also, would there be any hardware configuration that I would have to do with the BF537 board in using the TWI module?
Any help with regards the topic would be greatly appreciated. Thanks!!
Here's the datasheet for the compass module: http://www.parallax.com/portals/0/downloads/docs/prod/sens/29133-CompassHMC5883LDatasheet.pdf
Attached as well is the program I made.