SDK 2.4.1 is what sourced the i2c example I was upset at last week. Also dated 2018-06-18.
On the left side of MCUXpresso IDE see the "Create or Import a project". Select "Import SDK example(s)..."
I have only one SDK installed, that for the 54628. I left-click the image to select the board then left-click "Next".
There are a number of examples listed in the lower half-pane. Open "driver_examples" and select "i2c".
The fifth example is "i2c_polling_b2b_transfer_master" and so I select that by setting the checkbox. To avoid a project collision, I change the prefix to "BOARD_" (that's at top left). Then click Finish.
The IDE runs... and I now have a project named "BOARD_i2c_polling_b2b_transfer_master".
Open the project then open the source folder. There is "i2c_polling_b2b_transfer_master.c"
Open "i2c_polling_b2b_transfer_master.c" and scroll down to line 131.
First, what does this program do? It sends a block of data, receives a block of data, compares the two, and hangs at the while-loop at line 200.
Okay. Line 131 contains the call to I2C_MasterStart.(). Hm. See below.
Lines 135 and 140 contain the calls to I2C_MasterWriteBlocking. I believe Line 135 calls the wrong function... because deviceAddress contains the i2c address of the slave and &deviceAddress is the address of a memory location containing the slave's address.
But the documentation (you can see it via hovering the cursor) says that the second argument is a pointer to the data to be transferred.
Line 140 passes supplies the address of the buffer to be transmitted. That's correct.
What is Line 131 doing? Line 131 takes the I2C reference, something called "I2C_MASTER_SLAVE_ADDR_7BIT", and the last argument is kI2C_Write. I2C_MASTER_SLAVE_ADDR_7BIT is a symbol with value 0x7EU. I thought that address reserved.for future purpose.
Before my end, I did get an I2C transfer running. I'm writing this from memory.. but I do remember that an attached oscilloscope showed the I2C bus handshake between master and slave.
I2C_MasterStart(EXAMPLE_I2C_MASTER, deviceAddress, kI2C_Write); // Set slave address.
I2C_MasterWriteBlocking(EXAMPLE_I2C_MASTER, g_master_txBuff, I2C_DATA_LENGTH, 0); // Start transaction.
I2C_MasterStop(EXAMPLE_I2C_MASTER); // End transaction.
All three functions are in fsl_i2c.h .
All this was with SDK 2.4.1 dated 2018-06-18. That's what was available Monday, October 15th.
==============
My apologies to the user community for the tone of my writing last week. I'd used similar-named routines on other devices, discounted that because, well, this is an NXP device, and went with what was in front of me rather than dig into the provided code. A "tight-schedule-hope-it-works" situation.
Mark