[PIC 32 MAXI WEB] I2C not functional

Started by benzinho, November 19, 2015, 07:34:48 pm

Previous topic - Next topic

benzinho

Hi, i have a Pic 32 Maxi Web and i have been facing frustrating days since tried to put a simple  I2C communication working with a TC74 Termometer. I don't think it is a problem in the code since i have absolutely no clock or data signal, checking with an oscilloscope both are always is stuck on high. I notice that the board has internal I2C pull ups, so i'm not using any external. Does someone have an idea on what could possible be ?
I'm using the I2C functions on the plib.h library, although i already tried with my own, tested in the past, and also with no success.


#include <plib.h>
#include <stdint.h>

#define SENS_ADDRESS 0x4D // device dependent
#define WRITE 0
#define READ 1
#define SYSCLK 80000000L
#define PBCLK  40000000L

#define ADDR_WR ((SENS_ADDRESS << 1) | WRITE)

void main (void) {
   
    SYSTEMConfigPerformance(SYSCLK);

    I2CEnable(I2C1, TRUE);
    I2CSetFrequency(I2C1,PBCLK,100000);
   
   
    while(1){
         
        while(!I2CBusIsIdle(I2C1));

        I2CStart(I2C1);

        while(!I2CTransmitterIsReady(I2C1));

        I2CSendByte(I2C1, 0x1);

        if(I2CTransmissionHasCompleted(I2C1))
        {
            if (I2CByteWasAcknowledged(I2C1))
            {
            printf("Ack");
            }
        }
           and continues but i think it would be enough to see the clock signal.....

 

Thank you very much

JohnS

For those who don't know enough... maybe say more about which pins you hope to see what occur on.

If any are analog, be sure to turn that off.

John