The set up is:
1. EasyPICFusionv7 with TFT and PIC32MX795F512L.
2. Compass 4 Click in left BUS 1 socket.
3. RS232 Click in right BUS 2 socket - or use the USB/UARTB for RF12/RF13.
The Compass 4 Click has a few catches. You really need to read the manual for the AK09915 chip:
1. The write address is 0x18. The click board jumpers are not set as shown on the circuit diagram (The Mikro chip carrier ties the address pins CAD0=0 and CAD1=0)
2. 100ns minimum delay after any MODE change.
3. Must read register STATUS2 after reading the fields Mx My My in CONTINUOUS MODE at 10Hz, 20Hz etc
4. The field strengths need normalising, scaling and adjusting before using arctan2 to work out a heading (0 to 360 degrees):
- Read the max and min values whilst rotating the board.
- Normalise, for example Mx_normalised = (Mx - Mxmin)/(Mxmax - Mxmin) so the range is 0 to +1
- Then scale and shift, for example Mx_scale_shift = (Mx_normalised * 2) - 1 so the range = -1 to +1
If you I2C comms fail it may be due to handling the area of mikroBUS1 and upsetting the voltages on the pins - keep your fingers on the board edges only.
Regards Bill Legge in Australia