cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with SETDASA Dynamic Addressing for P3T1755 on Nucleo-H503RB (I3C)

zakir_daniarov
Associate

Hello STM32 Community,

I'm working on an STM32 Nucleo-H503RB board and trying to communicate with a P3T1755 temperature sensor over I3C. According to the P3T1755 datasheet, I need to perform dynamic addressing using the SETDASA CCC. I followed the official ST I3C guideline (Getting started with I3C - stm32mcu) and adapted the LPS22HH example to my setup. However, I'm encountering an issue.

Current Setup & Process:

  1. Disable IBI interrupt (DISEC CCC)Works correctly (Verified on oscilloscope :white_heavy_check_mark:)

  2. Reset previous dynamic address (RSTDAA CCC)Works correctly (Verified on oscilloscope :white_heavy_check_mark:)

  3. Assign dynamic address using SETDASA CCCFails :cross_mark:

Issue Details:

  • The error occurs at:

    if (HAL_I3C_AddDescToFrame(&hi3c1, aSET_DASA_P3T1755, NULL, &aContextBuffers[I3C_IDX_FRAME_1], 1, I3C_DIRECT_WITHOUT_DEFBYTE_RESTART) != HAL_OK) { Error_Handler(); }
  • On the oscilloscope, SDA and SCL remain constant after the second step (RSTDAA).

Questions:

  1. Has anyone successfully assigned a dynamic address to the P3T1755 sensor using I3C on STM32?

  2. Any debugging suggestions to ensure the P3T1755 properly receives and acknowledges the dynamic address?

Full Code:

/* USER CODE BEGIN PTD */
#define Direct_GETDCR 0x8F // GETDCR CCC Code
#define Direct_SETDASA 0x87
#define Broadcast_DISEC 0x01
#define Broadcast_RSTDAA 0x06

#define P3T1755_STATIC_ADDR 0x4F // ‌‌ This is correct from your sensor setup
#define P3T1755_DYNAMIC_ADDR 0x32 // ‌‌ You can assign any valid 7-bit dynamic address
/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
#define I3C_IDX_FRAME_1 0U /* Index of Frame 1 */
#define I3C_IDX_FRAME_2 1U /* Index of Frame 2 */
/* USER CODE END PD */
/* USER CODE BEGIN PV */
uint8_t aSETDASA_P3T1755_data[1] = {(P3T1755_DYNAMIC_ADDR << 1)};
uint8_t aDISEC_data[1] = {0x08}; // Disable IBI interrupt

/* Buffer used for transmission */
uint8_t aTxBuffer[0x0F];

/* Buffer used by HAL to compute control data for the Private Communication */
uint32_t aControlBuffer[0xF];

/* Context buffer related to Frame context, contain different buffer value for a communication */
I3C_XferTypeDef aContextBuffers[2];

/* Descriptor for direct write SETDASA CCC */
I3C_CCCTypeDef aSET_DASA_P3T1755[] =
{
/*Target Addr CCC Value CCC data + defbyte pointer CCC size + defbyte Direction */
{0x4F,Direct_SETDASA,{aSETDASA_P3T1755_data,1},HAL_I3C_DIRECTION_WRITE},
};

/* Descriptor for direct write DISEC CCC */
I3C_CCCTypeDef aSET_CCC_DISEC[] =
{
{0x4F,Broadcast_DISEC, {aDISEC_data,1},LL_I3C_DIRECTION_WRITE},
};

/* Descriptor for direct write RST CCC */
I3C_CCCTypeDef aSET_CCC_RST[] =
{
{0x4F,Broadcast_RSTDAA, {NULL,0},LL_I3C_DIRECTION_WRITE},
};
/* USER CODE END PV */
/* USER CODE BEGIN 2 */

/* Send a DISEC to disable IBI interrupt */
aContextBuffers[I3C_IDX_FRAME_1].CtrlBuf.pBuffer = aControlBuffer;
aContextBuffers[I3C_IDX_FRAME_1].CtrlBuf.Size = 1;
aContextBuffers[I3C_IDX_FRAME_1].TxBuf.pBuffer = aTxBuffer;
aContextBuffers[I3C_IDX_FRAME_1].TxBuf.Size = 1;

/* Add context buffer Set CCC frame in Frame context */
if (HAL_I3C_AddDescToFrame(&hi3c1,
aSET_CCC_DISEC,
NULL,
aContextBuffers,
1,
I3C_BROADCAST_WITHOUT_DEFBYTE_RESTART) != HAL_OK)
{
Error_Handler();
}

if (HAL_I3C_Ctrl_TransmitCCC(&hi3c1, aContextBuffers, 1000) != HAL_OK)
{
Error_Handler();
}

while (HAL_I3C_GetState(&hi3c1) != HAL_I3C_STATE_READY)
{
}

/* Send a RSTDAA to reset previous dynamic address the target */
aContextBuffers[I3C_IDX_FRAME_1].CtrlBuf.pBuffer = aControlBuffer;
aContextBuffers[I3C_IDX_FRAME_1].CtrlBuf.Size = 1;
aContextBuffers[I3C_IDX_FRAME_1].TxBuf.pBuffer = aTxBuffer;
aContextBuffers[I3C_IDX_FRAME_1].TxBuf.Size = 1;

/*Add context buffer Set CCC frame in Frame context */
if (HAL_I3C_AddDescToFrame(&hi3c1,
aSET_CCC_RST,
NULL,
aContextBuffers,
1,
I3C_BROADCAST_WITHOUT_DEFBYTE_RESTART) != HAL_OK)
{
Error_Handler();
}

if (HAL_I3C_Ctrl_TransmitCCC(&hi3c1, aContextBuffers, 1000) != HAL_OK)
{
Error_Handler();
}

while (HAL_I3C_GetState(&hi3c1) != HAL_I3C_STATE_READY)
{
}

/* Send a SETDASA to set the dynamic on P3T1755 using his static address */
aContextBuffers[I3C_IDX_FRAME_1].CtrlBuf.pBuffer = aControlBuffer;
aContextBuffers[I3C_IDX_FRAME_1].CtrlBuf.Size = 1;
aContextBuffers[I3C_IDX_FRAME_1].TxBuf.pBuffer = aTxBuffer;
aContextBuffers[I3C_IDX_FRAME_1].TxBuf.Size = 1;

/* Add context buffer Set CCC frame in Frame context */
if (HAL_I3C_AddDescToFrame(&hi3c1,
aSET_DASA_P3T1755,
NULL,
&aContextBuffers[I3C_IDX_FRAME_1],
1,
I3C_DIRECT_WITHOUT_DEFBYTE_RESTART) != HAL_OK)
{
Error_Handler();
}

if (HAL_I3C_Ctrl_TransmitCCC_IT(&hi3c1, &aContextBuffers[I3C_IDX_FRAME_1]) != HAL_OK)
{
Error_Handler();
}

while (HAL_I3C_GetState(&hi3c1) != HAL_I3C_STATE_READY)
{
}

/* After a dynamic address has been assigned, the sensor is recognized as an I3C device */
/* Check if the P3T1755 sensor is ready to communicate in I3C */
if (HAL_I3C_Ctrl_IsDeviceI3C_Ready(&hi3c1, P3T1755_DYNAMIC_ADDR, 300, 1000) != HAL_OK)
{
Error_Handler();
}

/* USER CODE END 2 */
1 REPLY 1
Foued_KH
ST Employee

Hello @zakir_daniarov , 

First of all, you can use ENTDAA CCC to assign a dynamic address for  P3T1755 temperature sensor , also you can assign a dynamic address using SETDASA. As showing in this Table of DS : 

Foued_KH_0-1744640295020.png

For SETDASA, make sur that you are using the correct static address for P3T1755.( can just start an I2C communication to make sure that this value is an I2C static address )

Thank you!
Foued

 

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.