cancel
Showing results for 
Search instead for 
Did you mean: 

I2C error in sending data (for the oscilloscope)

Xenon02
Senior

Hello ! 

I've got a problem because I tried to check the SDA and SCL pins like in the picture : 

Xenon02_0-1700670192061.png

 


Sorry for the paint picture (the oscilloscope was during classes so I don't have it right now).
The output was all the time noises even thought the code was correct. 

  uint8_t data = 0;
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {

	  HAL_I2C_Master_Transmit(&hi2c3, 0xA0, &data, 1, 100);
	  
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}


I've had this error : 

Xenon02_1-1700670341278.png

I don't know if this Timeout is because the I2C didn't receive the ACK bit ? 

But when I've added the pull up resistors : 

Xenon02_2-1700670423029.png

The error was then this part : 

Xenon02_3-1700670458974.png



I don't really much know what happened though. 
Maybe if I want to check the I2C in oscilloscope I have to connect an I2C slave ? 
But I don't understand why I had 2 different errors. 

In RM for STM32 Nucleo-L073RZ I found this : 

Xenon02_4-1700670585480.png

I don't know if I2C_RXDR is the ACK bit that Master is now an input and waits for this ACK/I2C_RXDR ? Maybe but this stretch was maybe a timeout ? 

I got a bit confused. Is master receiving more data through SDA (or maybe SLC although it is only a clock), not just only Start, Stop, ACK and data ? 

Also the Transmission is different because it stretches the clock after ACK and Receiver before ACK, weird, somebody knows why ? 

Thanks ! 

10 REPLIES 10

1. sinusoidal on scope is fail connection or fail scope input.

I've checked many times the connection, changed the oscilloscope, changed the wires etc. 
The only thing that wasn't there were pull up resistors. 

>2. learn I2C bus theory. On inactive state no input or output exist. Only pullups.

When you as master call traffic func, first step peripheral check if bus is free and ok only pullups...

If it checks the bus if it's free it must take the data so it must be input to take the value (then he checks this value because he has to take the value first). Atleast that's what I've thought.