I2C write problem


#1

I have a Wavecom M1306B and i am trying the I2C bus. The problem is that althpugh i can see the clock running from the SCL pin i can’t see any data flowing from SDA. I am using also pull up resistors.

Here is my code

bool I2C_Init ( void )
{

adl_atSendResponse ( ADL_AT_UNS, “\r\nEntered Initialisation\r\n” );

DRV_HANDLE = adl_busSubscribe ( ADL_BUS_TYPE_I2C_SOFT ,
ADL_IO_ID_U32_TO_U16 ( ADL_IO_Q24X6_GPIO_5 )
| ( ADL_IO_ID_U32_TO_U16 (ADL_IO_Q24X6_GPIO_4 ) << 16 ) );

/* Test Handle */

if ( DRV_HANDLE < 0 )
{
    /* Error while opening bus */
	adl_atSendResponse ( ADL_AT_UNS, "\r\nFailed to initialise driver \r\n" );
	return FALSE;
}
else
	return TRUE;

}

void I2C_Write ( void )
{
u8 testData=0x30;
s8 resp;
char outBuff[50];
void *Data;

Data= & testData;
    adl_atSendResponse ( ADL_AT_UNS, "\r\nInside write function \r\n" );   

/* Write on I2C bus */
resp=adl_busWrite ( DRV_HANDLE, NULL, 1, Data);

if ( resp<0 )
{
    wm_sprintf ( outBuff, "\r\nFAILURE CODE %d...\r\n", resp  );
	adl_atSendResponse ( ADL_AT_UNS,  outBuff ); 	
}

}


#2

I forgot to write that i am using OpenAT 3.02


#3

You also forgot to use the ‘Code’ button to preserve the layout of your source - so now it’s illegible! :cry:

Please re-post the code, using the ‘Code’ button - it should look something like this:

if ( DRV_HANDLE < 0 ) 
   { 
      /* Error while opening bus */ 
      adl_atSendResponse ( ADL_AT_UNS, "\r\nFailed to initialise driver \r\n" ); 
      return FALSE; 
   } 
   else 
      return TRUE;

Use the ‘Preview’ button to confirm that it looks OK before pressing ‘Submit