cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4xx I2C waveform is something strange.

ihbaek.wcabaid
Associate II

stm32l4xx-1-edited.png

figure-1 I2C waveform with STM32L433rc-p Nucleo board.

When I try to use STM32L433RC-P Nucleo's I2C for communicating with AT24C01 I2C EEPROM, two strange waveform occurred. This strange waveform is not occurred from another model STM32 MCU.(example. STM32G0xx Nucleo board. See below figure.2.)
1. It makes strange low level spike.
2. It makes strange and very narrow I2C waveform compared to other  STM32 MCU devices.

I used HAL function "HAL_I2C_Mem_Read(&hi2c1, 0xA0, 0x00, 1, &dat, 1, 1000);" for I2C commucating with AT24C01 device.  

I didn't experienced any I2C communation error with that strange waveform, but I want to confirmed this strange waveform don't affected I2C norminal operation.

Is these strange waveforms normal case?

 

stm32g0xx.PNG

figure.2 - I2C waveform from STM32G0B1RE Nucleo board.

5 REPLIES 5

The spikes may be consequence of crosstalk (too long SDA/SCL close to each other) or improper ground/return arrangement. I hope you are not attempting to use jumper wires and solderless breadboards

Besides reviewing hardware try decreasing the SCLs OSPEEDR setting.

[EDIT] see my next post below [/EDIT]

JW

 

You haven't said what pins you're using for I2C.

Show a schematic of your setup.

Some good, clear photos may also help.

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

Have you checked the board's User Manual and/or schematics to see if there's anything else on those pins?

 

When I changed the pins from PB7/PB8 to PB6/PB9, nothing changed. It makes same waveform. So, I guess it's not port electric characteristic problem.

[Part Number] : I am using two devices of STM32L4xx. one part number is STM32L433RCT6P, mounted on Nucleo L433RC-P devices, connected to AT24C01.  another number is STM32L431RBT, mounted on our own PCB, connected to M24C04 I2C EEPROM.
[Environment] : I used CubeIDE 1.14.0 and CubeIDE 1.10.0. No difference behavior exist between two. I already checked.
[How to reproduce]

1. connect Nucleo L433RC-P board to AT24Cxx test board with jumper wire.

- You can buy AT24Cxx test board from this site. https://www.waveshare.com/at24cxx-eeprom-board.htm

KakaoTalk_20241126_120818833.jpg

2. make CubeIDE project. Import below code. and run.

 

  while (1)
  {
    uint8_t dat;
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
    HAL_I2C_Mem_Read(&hi2c1, 0xA0, 0x00, 1, &dat, 1, 1000);
    HAL_Delay(1000);
  }

 

3. probe scope and see waveform.

 

I added additional detailed waveform below.

S20V_01.PNG

 

I have two device for STM32L4xx product.

One is Nucleo test board. another is our real PCB soldered product.
Both produce makes same waveform. So, I think HW/pattern problem is not choice.  

I realized that this is a normal waveform and depends on particular circumstances such as clock speed, slave's speed etc.

Thing is, that I2C shifts out (changes output) SDA at falling edge of SCL and samples (shifts in, reads) at "rising" edge. More precisely, during the SCL high period. Quoting from the I2C spec: "The data on the SDA line must be stable during the HIGH period of the clock." During SCL low, any changes are allowed.

In this case, the first, shorter peak happens just after the 8th data bit, i.e. master (in modern I2C parlance, "controller"; here: STM32) releases SDA and it succeeds to rise high enough to be noticed when the slave ("target", here: EEPROM) pulls it down to signal ACK. And the next, longer pulse, is after slave releases ACK upon the next shift clock edge, and before STM32 pulls SDA down because of the MSB of next byte is 0.

JW