AnsweredAssumed Answered

LPC54628 I2C polling master example code not quite right.

Question asked by Mark Becker on Oct 18, 2018
Latest reply on Oct 23, 2018 by Hui_Ma

Does anyone look at the examples and wonder what's going on?

 

Would it be too hard to ask for working examples?  I know, they're "examples".  But this one is a lulu.  It couldn't ever have worked, not as is.  Maybe this is one of their training examples where students are asked "to find the bugs" and answers deliberately aren't incorporated.

 

The block of code below is from i2c_polling_b2b_transfer_master.c.  Take a look at the usage of I2C_MasterWriteBlocking(); the two lines are marked with "<==HERE".  In the first instance, the address of uint8_t deviceAddress is passed.  In the second instance, the address of the data buffer to transmit is passed.  The compiler is told to expect a const void * so the compiler doesn't "squeak".

 

I had one job: to get FLEXComm8 talking to a resistive touch screen controller via i2c.  By the next morning.  Because of the time constraint, my thought was to use an example and build from that.

 

NXP + Murphy paid a visit to the SDK creators: the example doesn't work.  Looks like a cut-and-paste from somewhere else.  Now I'm on the market, looking for work..

 

I can't recommend NXP products.  Not any more.  I can't afford the time to investigate boobytraps.  Guys, time-to-market is ever decreasing.  Please understand that your customers aren't supposed to be beta test sites, not for stuff like this.

 

Looking for work in the Eastern Massachusetts area...

 

============================================================================

 

/* Send master blocking data to slave */
if (kStatus_Success == I2C_MasterStart(EXAMPLE_I2C_MASTER, I2C_MASTER_SLAVE_ADDR_7BIT, kI2C_Write))
{

   /* subAddress = 0x01, data = g_master_txBuff - write to slave.
       start + slaveaddress(w) + subAddress + length of data buffer + data buffer + stop*/
   reVal = I2C_MasterWriteBlocking(EXAMPLE_I2C_MASTER, &deviceAddress, 1, kI2C_TransferNoStopFlag);   <== HERE
   if (reVal != kStatus_Success)
   {
   return -1;
   }
   reVal = I2C_MasterWriteBlocking(EXAMPLE_I2C_MASTER, g_master_txBuff, I2C_DATA_LENGTH, 0);            <== HERE
   if (reVal != kStatus_Success)
   {
       return -1;
   }

   reVal = I2C_MasterStop(EXAMPLE_I2C_MASTER);

Outcomes