How to use I3C in MIMXRT595-EVK

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

How to use I3C in MIMXRT595-EVK

6,013 Views
IronMouse
Contributor I

Hello,

I want to use MIMXRT595-EVK to communicte with I3C slave sensor, ex TDK ICM-42688-P.

I referenced I3C example in I.MX RT500 and RT600.

I2C slave address is 0x68, ChipID register address 0x75, value should be 0x47.

But I got ChipID is 0x4E.

After change i3cPushPullBaud and i3cOpenDrainBaud, ChipID is 0x0E.

How to use I3C correctly?

Thanks.

 

I3C_MasterGetDefaultConfig(&masterConfig);
I3C_MasterInit(EXAMPLE_MASTER, &masterConfig, I3C_MASTER_CLOCK_FREQUENCY);
PRINTF("i3cPushPullBaud: %d\r\n", masterConfig.baudRate_Hz.i3cPushPullBaud);
PRINTF("i3cOpenDrainBaud: %d\r\n", masterConfig.baudRate_Hz.i3cOpenDrainBaud);
uint8_t AddrList[2] = {0x30, 0x31};
result = I3C_MasterProcessDAA(EXAMPLE_MASTER, AddrList, 2);
if(result == kStatus_Success)
	PRINTF("DAA OK\r\n");
else
	PRINTF("DAA Failure, Error: 0x%02X\r\n", result);
 
uint8_t CHIPID = 0xAA;
memset(&masterXfer, 0, sizeof(masterXfer));
masterXfer.slaveAddress= 0x30;
masterXfer.direction= kI3C_Read;
masterXfer.busType  = kI3C_TypeI3CSdr;
masterXfer.subaddress  = 0x75;
masterXfer.subaddressSize = 1;
masterXfer.data  = &CHIPID;
masterXfer.dataSize = 1;
masterXfer.flags = kI3C_TransferRepeatedStartFlag;
result = I3C_MasterTransferBlocking(EXAMPLE_MASTER, &masterXfer);
if(result == kStatus_Success)
	PRINTF("Chip ID = 0x%02X\r\n", CHIPID);
else
	PRINTF("Read Failure, Error: 0x%02X\r\n", result);

 

2021-07-16_070316.jpg2021-07-16_070619.jpg

0 Kudos
Reply
16 Replies

4,386 Views
fubatt
Contributor I

Hey everyone, 

are there any shareable news on that? 
I've encountered the exact same issues with the same hardware as described throughout this thread (MIMXRT595-EVK and InvenSense TDK ICM 42688-P). 

Thanks a lot for every bit of help!

 

0 Kudos
Reply

4,290 Views
fubatt
Contributor I

I was able to find the reason for these issues to appear (at least in my case). 
I was using standard jumper wires which added too much capacitance to the I3C bus (max. 50pF allowed). 

Once I've exchanged them with other jumper wires (bigger cross-section), everything worked beautifully. 

 

Maybe this could help someone one day. 
Best regards,
fubbat

0 Kudos
Reply

5,998 Views
IronMouse
Contributor I

Update SDK to 2.10.0, the problem is same

0 Kudos
Reply

5,994 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse 

   Do you test the I3C wave on the I3C bus, whether wave data is not correct?

  Can you readout the 48bit UID+BCR+DCR or not? From your test print information, your DAA is OK, but it's better to check the I3C wave.

  Do you test this part for your company project? If yes, you can use your company email to create the nxp.com case, then I can send you some related code projects for your reference.

Best Regards,

Kerry

 

0 Kudos
Reply

5,991 Views
IronMouse
Contributor I

Thank you for reply.

I will test I3C waveform next week, and update result.

And how to read 48bit UID+BCR+DCR?

Thanks.

0 Kudos
Reply

5,989 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse 

Your DAA can get the UID, BCR and DCR.

kerryzhou_0-1626424204601.png

 

Wish it helps you!

Best Regards,

Kerry

 

0 Kudos
Reply

5,976 Views
IronMouse
Contributor I

Hi @kerryzhou ,

I referenced AN12796SW(RT600 I3C Simple Controller, Associated File)

https://www.nxp.com/webapp/Download?colCode=AN12796SW&location=null

Replaced I3C_MasterProcessDAA by the following code

SETDASA is OK, but get PID+BCR+BCD is failed

2021-07-17_074150.jpg

 

 

PRINTF("Broadcast CCC DISEC (DISHJ + DISMR + DISINT): ");
display_ccc_status(i3c_ccc_disec_b(CCC_DISEC_BYTE_DISHJ | CCC_DISEC_BYTE_DISMR | CCC_DISEC_BYTE_DISINT));
PRINTF("\r\n");

PRINTF("Broadcast CCC RSTDAA: ");
display_ccc_status(i3c_ccc_rstdaa_b());
PRINTF("\r\n");

i3c_demo_setdasa(0x68, 0x30);

void i3c_demo_setdasa(uint8_t static_address, uint8_t dynamic_address)
{
uint8_t loc_pid[6], loc_bcr, loc_dcr;
enum I3C_COMM_STATUS loc_i3c_comm_status;

PRINTF("Direct CCC SETDASA (hex static addr = %2X, dynamic addr = %2X): ", static_address, dynamic_address);
PRINTF("\r\n");
loc_i3c_comm_status = i3c_ccc_setdasa(static_address, dynamic_address);
PRINTF("CCC: SETDASA: ");
display_ccc_status(loc_i3c_comm_status);
PRINTF("\r\n");
if (loc_i3c_comm_status == I3C_COMM_DONE_OK)
{
  
  loc_i3c_comm_status = i3c_ccc_getpid(dynamic_address, (uint8_t *)&loc_pid);
  PRINTF("CCC: GETPID: ");
  display_ccc_status(loc_i3c_comm_status);
  PRINTF("\r\n");
  loc_i3c_comm_status = i3c_ccc_getbcr(dynamic_address, (uint8_t *)&loc_bcr);
  PRINTF("CCC: GETBCR: ");
  display_ccc_status(loc_i3c_comm_status);
  PRINTF("\r\n");
  loc_i3c_comm_status = i3c_ccc_getdcr(dynamic_address, (uint8_t *)&loc_dcr);
  PRINTF("CCC: GETDCR: ");
  display_ccc_status(loc_i3c_comm_status);
  PRINTF("\r\n");
  
  PRINTF("hex PID + BCR + DCR: ");
  PRINTF("%2X %2X %2X %2X %2X %2X  ", loc_pid[0], loc_pid[1], loc_pid[2], loc_pid[3], loc_pid[4], loc_pid[5]);
  PRINTF("%2X %2X", loc_bcr, loc_dcr);
  PRINTF("\r\n");
}

return;
}

 

 

Thanks.

0 Kudos
Reply

5,957 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse 

   From your test result, still have issues, as I know, your ICM-42688 can support the ENTDAA and the SETDASA, GETPID, GETBCR, GETDCR CCC commander.

   If you can't get the correct BCR, DCR, PID, seems still have issues, whether your hardware connection has issues or not? Do you check the related I3C bus wave?

If you have the logical analyzer, it's better to check the I3C wave data, it will useful to check issues. Please also check your static address, whether that is correct or not?

Best Regards,

Kerry

 

0 Kudos
Reply

5,950 Views
IronMouse
Contributor I

Hi @kerryzhou ,

Decoder of logical analyzer only have I2C, not I3C.

But decode result still be readable.

Work in I2C, response from device is good.

2021-07-19_152355.jpg

Work in I3C, SETDASA and static address is OK,

but dynamic address 0x30, response NACK.

2021-07-19_151842.jpg

And try GETPID command, response of dynamic address is ACK.

But data byte is odd.

2021-07-19_151924.jpg

Thanks.

0 Kudos
Reply

5,943 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse 

  Please check the private message, I share you one ICM42688 project for the RT685, you can use the related files and add to your RT595, then test it, whether that can work directly or not.

the project details, please check the project readme.txt.

 

Wish it helps you!

Best Regards,

kerry

0 Kudos
Reply

5,916 Views
IronMouse
Contributor I

Hi @kerryzhou 

Read register is OK, but have some question.

1. FSL_I3C_DRIVER_VERSION of your sample is 2.4.0.

   But driver version of SDK 2.1.0 is 2.3.2, it lacks some funtcion,

    ex."I3C_BusMasterSetDynamicAddrFromStaticAddr"

    Although I can add this function manaually.

    When 2.4.0 or newer version will be released?

2. Slave device is connected in J18 connector of EVK.

    Probe of logical analyzer is connected to SCL,

    and GND of probe is connected to GND of device,

    the communication is OK even if probe is disconnected from logical analyzer.

    When remove probe, communication is failure.

    I try change slew rate  of pin config from SLEW_RATE_SLOW to SLEW_RATE_NORMAL,

    and using FULLDRIVE_EN setting, it doesn't help.

    I already try ICM-42605, ICM-42688-P, IIM-42352, IIM-42652, same problem.

    What happen? wire/trace issue?

    I don't have oscilloscope, the waveform cannot be provided.

    And I think that probe of oscilloscope is attached, communication will be OK.

3. When using "I3C_BusMasterDoTransferToI3CDev"(referenced for sample code),

    HardFault_Handler will be issued.

    HardFault in this line(fsl_component_i3c_adapter.c),  2021-07-20_223152.jpg

    So I replaced by "I3C_MasterTransferBlocking", transfer will be OK.
    How to correct it?
4. After send CCC, SDA will be hang on high
    Send GETBCR, slave return ACK, but SDA hang on low.
    "I3C_BusMasterSendCCC" will be hang about few seconds, until to timeout.
    So, next GETHDRCAP command is failure.
2021-07-21_081922.jpg 
2021-07-21_082558.jpg2021-07-21_082845.jpg
5. How to transfer in HDR-DDR mode?
    I check BCR[5] = 1, HDR capable
    and check GETHDRCAP = 1, HDR-DDR mode
    Change kI3C_TypeI3CSdr to kI3C_TypeI3CDdr in i3c_master_transfer_t struct
    It hang on I3C_MasterTransferBlocking, how to transfer in HDR-DDR?
2021-07-20_233235.jpg  2021-07-20_233301.jpg2021-07-20_233406.jpg
 
 
Thanks.
0 Kudos
Reply

5,907 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse ,

    The SDK version should not important, it is the internal SDK code for your mentioned sensor, as I don't have your mentioned I3C sensor, so can't test it directly, I just has the AN mentioned MK192V1 and MKI197V2, which is tested in the previous time, and it works OK.

   Do you test the ICM modules for yourself or your company?

    If you are working this topic for your company, it's better to use your company email to create the case, then I can put more time and effort on it.

   About your questions:

1. the code which I share you is from the I3C SDK owner, that has been tested with ICM-42688 on MIMXRT685-EVK. 

It calls:

result = I3C_BusMasterSetDynamicAddrFromStaticAddr(&demo_masterDev, SENSOR_STATIC_ADDRESS, sensorAddr);

This API is in the fsl_component_i3c.c, not the driver.

2. probe add works, probe remove can't work, seems still not stable, do you use the long wire to connect the EVK and your sensor board?

3. you meet hardfault issues, should still the porting from RT685 to RT595 issues.

 Please let me know, whether your  issue is your company project issues, then I will help you to check internally, just to check whether there has RT595 related code or not.

4,5.  Your code is still based on the AN12796SW or yourself write code?

 

Best Regards,

kerry

 

 

   

0 Kudos
Reply

5,902 Views
IronMouse
Contributor I

Hi @kerryzhou 

My company product is sensor component, not included MCU.
We prepare I3C environment for testing and driver coding.
In this monent, use InvenSense IC for I3C communication testing
In this case, can create case?
If can create, just register a account by using company email? need other apply process?
Q2, wire length is about 9 cm.
Q4&Q5, code is based your sample, just add send CCC part.(attached file)

0 Kudos
Reply

5,900 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse 

  Yes, use your company email instead of the 3rd part email to create the case private, the case create flow:

1. Open below SUPPORT site, click blue "Go to Tickets" in the middle.
http://www.nxp.com/support/support:SUPPORTHOME

2.Then you will be requested to Login, if you have no an account, please first Register with your business email.

3.After login, please "Create New Cases" button in the middle, then you can submit your question.

 

9cm wire should be OK, I also test it similarly.

So, create the case at first, then I will try to find your used sensor associated with the RT595, it will make the issue talking more easily. I may try to borrow the sensor from my colleague in a different city.

Best Regards,

kerry

 

0 Kudos
Reply

5,893 Views
IronMouse
Contributor I

Hi @kerryzhou 

OK, I already created a case.

Thanks.

0 Kudos
Reply

5,888 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @IronMouse 

Already get your case, and will find more internal resource and reply you in your case directly.

Please keep patient, thanks.

Best Regards,

kerry

0 Kudos
Reply