Skip to main content
gil23
Associate III
December 7, 2020
Question

STM32F4 I2C SDA & SCL rise time

  • December 7, 2020
  • 6 replies
  • 4116 views

Hi,

I working with STM32F401RET6 64 pins Nucleo board with IAR.

According to the datasheet DM00086815 Section 6.3.19 SDA and SCL rise time = 300ns.

I open the project from “STM32Cube_FW_F4_V1.25.0�? STM32F410xx-Nucleo\Examples\I2C\I2C_TwoBoards_ComPolling.

I change the clock setting to fit my board to get: SYSCLK(Hz) = 84MHz & Fpclk1 = 42MHz.

I connect my probes direct to board pins PB6 & PB9.

Then I measured and I get that 0693W000006EojXQAS.jpg SDA and SCL rise time = 1.2us.

Attached oscilloscope picture.

I tried to change configuration to  “GPIO_InitStruct.Speed    = GPIO_SPEED_HIGH�? but I didn’t see any change.

Please advise.

The configuration of the clock that I change :

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

 RCC_OscInitStruct.HSIState = RCC_HSI_ON;

 RCC_OscInitStruct.HSICalibrationValue = 16;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

 RCC_OscInitStruct.PLL.PLLM = 16;

 RCC_OscInitStruct.PLL.PLLN = 336;

 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;

 RCC_OscInitStruct.PLL.PLLQ = 4;

 HAL_RCC_OscConfig(&RCC_OscInitStruct);

 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;

 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;

 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

 HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);

This topic has been closed for replies.

6 replies

waclawek.jan
Super User
December 7, 2020

I2C signals are driven by Open-Drain transistors, and their rise time is given by pullup resistors you are supposed to add externally.

The internal pullup is nominally cca 40kOhm, which may be sufficient only if the load is of low capacitance.

JW

TDK
December 7, 2020

The datasheet measurements are taken with a 4.7kOhm pullup resistor. Guessing you don't have any.

0693W000006ErDZQA0.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
gil23
gil23Author
Associate III
December 7, 2020

Thanks, it's woks,

I connect 4.7K pullup and the rise time is 100ns

gil23
gil23Author
Associate III
December 10, 2020

Hi,

Problem didn't solve completely,

I connect another STM32F401RET6 board, and I configured it with the same project only as a slave.

I connect 4.7K pullup between master board to slave board.

the rise time is now 550ns.

Please advise.

Attached oscilloscope picture.

0693W000006FIoDQAW.jpg

TDK
December 10, 2020

(ignore)

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
December 10, 2020

The risetime is simply given by RC constant. 550ns/4k7=cca 110pF, not an entirely unreasonable value, especially if you connect two boards with lengthy cables.

You can decrease the pullup's value, taking into consideration the maximum allowable pin current.

JW