MIMXRT685 I3C interrupt master example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MIMXRT685 I3C interrupt master example

Jump to solution
772 Views
DVL
Contributor II

此段SAMPLE程式碼只有看到示波器slaveAddress波形,但沒有Data資料,請問需要修改何處呢? 謝謝~

/*******************************************************************************
* Definitions
******************************************************************************/
#define EXAMPLE_MASTER I3C
#define EXAMPLE_I2C_BAUDRATE 400000
#define I3C_MASTER_CLOCK_FREQUENCY CLOCK_GetI3cClkFreq()
#define I3C_MASTER_SLAVE_ADDR_7BIT 0x1E
#define WAIT_TIME 1000
#define I3C_DATA_LENGTH 33

i3c_master_config_t masterConfig;
i3c_master_transfer_t masterXfer;
status_t result = kStatus_Success;

/* Attach main clock to I3C, 396MHz / 4 = 99MHz. */
CLOCK_AttachClk(kMAIN_CLK_to_I3C_CLK);
CLOCK_SetClkDiv(kCLOCK_DivI3cClk, 4);

BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();

PRINTF("\r\nI3C board2board Interrupt example -- Master transfer.\r\n");

/* I3C mode: Set up i3c master to work in I3C mode, send data to slave*/
/* First data in txBuff is data length of the transmitting data. */
g_master_txBuff[0] = I3C_DATA_LENGTH - 1U;
for (uint32_t i = 1U; i < I3C_DATA_LENGTH; i++)
{
g_master_txBuff[i] = i - 1;
}

PRINTF("\r\nStart to do I3C master transfer in I2C mode.\r\n");

PRINTF("Master will send data :");
for (uint32_t i = 0U; i < I3C_DATA_LENGTH - 1U; i++)
{
if (i % 8 == 0)
{
PRINTF("\r\n");
}
PRINTF("0x%2x ", g_master_txBuff[i + 1]);
}
PRINTF("\r\n\r\n");

I3C_MasterGetDefaultConfig(&masterConfig);
masterConfig.baudRate_Hz.i2cBaud = EXAMPLE_I2C_BAUDRATE;
masterConfig.baudRate_Hz.i3cPushPullBaud = 4000000U;
masterConfig.baudRate_Hz.i3cOpenDrainBaud = 1500000U;
masterConfig.enableOpenDrainStop = false;
I3C_MasterInit(EXAMPLE_MASTER, &masterConfig, I3C_MASTER_CLOCK_FREQUENCY);

/* Create I3C handle. */
I3C_MasterTransferCreateHandle(EXAMPLE_MASTER, &g_i3c_m_handle, &masterCallback, NULL);

memset(&masterXfer, 0, sizeof(masterXfer));

/* subAddress = 0x01, data = g_master_txBuff - write to slave.
start + slaveaddress(w) + subAddress + length of data buffer + data buffer + stop*/
uint8_t deviceAddress = 0x01U;
masterXfer.slaveAddress = I3C_MASTER_SLAVE_ADDR_7BIT;
masterXfer.direction = kI3C_Write;
masterXfer.busType = kI3C_TypeI2C;
masterXfer.subaddress = (uint32_t)deviceAddress;
masterXfer.subaddressSize = 1;
masterXfer.data = g_master_txBuff;
masterXfer.dataSize = I3C_DATA_LENGTH;
masterXfer.flags = kI3C_TransferDefaultFlag;

result = I3C_MasterTransferNonBlocking(EXAMPLE_MASTER, &g_i3c_m_handle, &masterXfer);

0 Kudos
1 Solution
677 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @DVL 

There is no demo with EEPROM, while there is I2C with accelerometer demo under SDK, you can have a look: "evkmimxrt685_i2c_read_accel_value_transfer "

 

BR

Alice

View solution in original post

0 Kudos
5 Replies
750 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @DVL 

 

What Data do you mean? Does your example from SDK? If yes, there is a readme.txt under DOC, you can  have a look.

Alice_Yang_0-1669712983510.png

 

 

BR

Alice

0 Kudos
738 Views
DVL
Contributor II
Hello Alice_Yang :

我有私下傳訊給你,請問是否收到呢?非常感謝~
0 Kudos
712 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @DVL 

Recommend you do not send private message, because it hard to notice it.

If you have do not want your information to be public, you can create a private ticket:

https://support.nxp.com/s/?language=en_US   

that only support engineer can see your message.

About  your description in your message, recommend  you  use logical analysis measure the data slave send, and refer to Datasheet of your EEPROM to check the whether returned a right slave address.

 

BR

Alice

 

0 Kudos
700 Views
DVL
Contributor II

你好@Alice

我是使用MIMXRT685開發版,需要使用I2C或I3C去讀寫EEPROM.
請問是否有範例可以參考使用使用I2C或I3C去讀寫EEPROM非常謝謝

例如使用I2C狀況下:其MASTER_BOARD設定為EVK-MIMXRT685 board,SLAVE_BOARD設定成EEPROM IC,MASTER_BOARD的J27-2,J27-1,J28-7供SLAVE_BOARD連接使用,但當掃描Slave Address時,只會出現內建的Slave address 0x0E & 0x1A & 0x34 & 0x35 Address回應

0 Kudos
678 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @DVL 

There is no demo with EEPROM, while there is I2C with accelerometer demo under SDK, you can have a look: "evkmimxrt685_i2c_read_accel_value_transfer "

 

BR

Alice

0 Kudos