Was wondering if anyone could give any ideas to help me solve this problem?
I am using a easypic6 development board, PIC18f4685, 4MHz, 10K pull up resistors on I2C bus and flowcode 5
this compass sensor - http://www.robot-electronics.co.uk/htm/cmps10doc.htm
and this LCD - http://www.robot-electronics.co.uk/htm/Lcd03tech.htm
I have attached a simple program that reads the heading from the compass sensor via I2C. I have also written code for the LCD to work which also works over the I2C bus. The LCD is working great!
Here are my observations this far -
- Nothing connected to SDA or SCL - works great I can see the data and the clock!
LCD connected to SDA/CSL works great!
If I connect the gyro nothing works. Data line is pulled low and the clock remains high. If I disconnect the gyro still nothing happens to get it to work again I have to disconnect the gyro from the bus and then turn the PIC off and on again. I have tried connecting the device once the PIC is powered up and also powering the whole lot up at the same time with the same result.
Power LED flashes on gyro when powering up.
I have checked and double checked that SDA/SCL are connected correctly to the gyro/PIC. I found that as soon as the gyro is connected my program seems to stop working - I have an LED that flashes each time it goes around the loop and this stops flashing. I have found that if I reset the PIC it seems to give a bit of a burst of I2C and then stops almost as if it is getting stuck somewhere on the first pass of the code.
I was working on this yeserday and someone the sensor would work sometimes - I could not figure out what caused it to work/not work. Sometimes just reprogramming it with the same .hex file cause it to work again. I have attached some screen shots of how it should have looked - which it did sometimes and then other times the data line would remain pulled low however it worked in cycles ie one time it works OK the next not and so on.