cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Issue between two H7 Dev Boards

voxe
Associate II

Hi, I've been trying to get an i2c connection working between two nucleo boards however nothing i have tried has worked. i am using the NUCLEO-H755ZI-Q and the NUCLEO-H723ZG both with i2c1 and on the same pins pb8(scl) and pb9(sba). for the H755 dual core I have the i2c on the M4 both for initiation and using the interface. None of the clock settings have been changed and should work with the schematics and the config settings in the mx file are identical. I did remove several SB jumpers on each board however they were to free up pins from the usb and ethernet ports and other i2c devices have worked it the ports since. I tried using a logic analyzer to see what was happening and it does not look right but I'm still not sure what is happening. the i2c master transmit uses HAL_I2C_IsDeviceReady and gets HAL_OK as a return, the first bit is received but the other two are not and this always returns with HAL_ERROR both by the transmit and slave receive functions.

So far i have tried:

External Pull up resistors

Different combinations of other i2cs on the boards

increasing the GPIO output speeds and using internal pull ups

changing the i2c adress on the slave and master(now set to 0x00)

 

 

//H755 master transmit
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_I2C1_Init();
  MX_I2C4_Init();
  MX_I2C2_Init();
  /* USER CODE BEGIN 2 */
  MX_USART3_UART_Init();

  HAL_I2C_Init(&hi2c1);
  HAL_Delay(1000);

  char txt[50];
  sprintf(txt,"uart Works for i2c\r\n");
  HAL_UART_Transmit(&huart3,(uint8_t*)txt,strlen(txt),1000);

  HAL_Delay(4000);

  HAL_StatusTypeDef RET0 = HAL_I2C_IsDeviceReady(&hi2c1, 0x00, 5, 1000);
  sprintf(txt,"i2c is %d\r\n",RET0);
  HAL_UART_Transmit(&huart3,(uint8_t*)txt,strlen(txt),1000);

  uint8_t TxD[3] = {65,35,69};
//  HAL_StatusTypeDef ret1 = HAL_I2C_Master_Transmit_DMA(&hi2c1, (0x60<<1), TxD, 3);
 // HAL_StatusTypeDef ret1 = HAL_I2C_Master_Transmit(&hi2c1, (0x60<<1), TxD, 3, 10000);
  HAL_StatusTypeDef ret1;
  ret1 = HAL_I2C_Master_Transmit(&hi2c1, 0x00, TxD, 3, 3000);
  ret1 = HAL_I2C_Master_Transmit(&hi2c1, 0x00, TxD, 3, 3000);
  ret1 = HAL_I2C_Master_Transmit(&hi2c1, 0x00, TxD, 3, 3000);
  ret1 = HAL_I2C_Master_Transmit(&hi2c1, 0x00, TxD, 3, 3000);

  sprintf(txt,"TxD sent with %d return \r\n",ret1);
  HAL_UART_Transmit(&huart3,(uint8_t*)txt,strlen(txt),1000);
  /* USER CODE END 2 */

 

 

 

 

 

 

//H723 slave recive 
 /* USER CODE BEGIN 2 */
  HAL_Delay(1000);

  char txt[50];
  sprintf(txt,"uart Works for i2c ipc\r\n");
  HAL_UART_Transmit(&huart3,(uint8_t*)txt,strlen(txt),1000);

  HAL_I2C_Init(&hi2c1);

  HAL_Delay(4000);

  uint8_t RxD[3] = {0,0,0};

  HAL_StatusTypeDef ret1;
  ret1 = HAL_I2C_Slave_Receive(&hi2c1, RxD, 3 , 3000);
  ret1 = HAL_I2C_Slave_Receive(&hi2c1, RxD, 3 , 3000);
  ret1 = HAL_I2C_Slave_Receive(&hi2c1, RxD, 3 , 3000);
  ret1 = HAL_I2C_Slave_Receive(&hi2c1, RxD, 3 , 3000);

  sprintf(txt,"recived 1= %d , 2= %d , 3= %d ret = %d\r\n",RxD[0],RxD[1],RxD[2],ret1);
  HAL_UART_Transmit(&huart3,(uint8_t*)txt,strlen(txt),1000);

  /* USER CODE END 2 */

 

 

The last 3 lines in both user code 2 parts of the scrit are repeaded in the while loop with no change to the output.

 

voxe_0-1727421627953.png

voxe_1-1727421824098.pngvoxe_2-1727421838542.png

 

I have been failing to get this to work for a couple of weeks now any advice is massively appreciated.

 

 

 

2 REPLIES 2
Karl Yamashita
Lead III

Change the slave address to something between 0x08 to 0x77. I believe addresses between 0x00 to 0x07 is does not conform to I2C specification

I Can't Believe It's Not Butter. If you find my answers useful, click the accept button so that way others can see the solution.

Indeed, addresses 0..7 are specified as Reserved:

AndrewNeil_0-1727428757293.png

https://www.nxp.com/docs/en/user-guide/UM10204.pdf#page=16