Skip to main content
Madhusudan
Associate
July 27, 2022
Question

Cannot interface SHT25 to STM32F4239I-DISC1 board BY I2C3.

  • July 27, 2022
  • 10 replies
  • 2579 views

Hi there,

I have made the touch project by touchgfx and initiated the I2C3 by cubemx.

I am interfacing the SHT25 with STM32F4239I-DISC1 board BY I2C3. PA8 AND PC9.

I am using the command HAL_I2C_Master_Transmit and HAL_I2C_Master_Receive. but I cannot get the values from the protocol. Any help is required.

This topic has been closed for replies.

10 replies

S.Ma
Principal
July 27, 2022

Use a sw bitbang first to get the fundation working. Check if the sensirion device has i2c protocol limitation in the past, they even provide drivers as workaround. Use low bitrate if there is a builtin mcu to convert analog sensor into a digital one. That is the case for sht30 for example.

Madhusudan
Associate
July 27, 2022

do you have any example for i2c3? because when i generate the code the i2c is configuring for memory interface only.

Madhusudan
Associate
July 27, 2022

or can i go for baremetal programming?

Andrew Neil
Super User
July 27, 2022

@Madhusudan​ "I cannot get the values from the protocol. "

Give more details:

  • What, exactly, did you try?
  • Do you have correct pullups?
  • What debugging have you done to find what's wrong?
  • Are you getting any error status returned?
  • Can you do anything basic - eg, does the chip have an ID you can read?
  • Are you sure you have the correct I2C address, and that you are presenting it correctly to the library?
  • Have you used an oscilloscope to check what's happening on the actual wires?
  • Have you checked that there's no conflict with other things on the Disco board?
  • Have you tried a simple project with just the sensor - without TouchGfx?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Madhusudan
Associate
July 27, 2022

there is no frequency on SDA and SCL

Andrew Neil
Super User
July 27, 2022

So that obviously explains why you can't get anything from the sensor!

Now you need to find out why there's no activity - most likely your STM32 configuration, or your external hardware - or both.

Are the lines stuck high or low?

Where, exactly, did you check?

Try checking directly at the processor pins with the sensor disconnected: if there's activity without the sensor connected, but that stops when it is connected - think what that tells you ...

These questions remain:

  • What, exactly, did you try?
  • Do you have correct pullups?
  • What debugging have you done to find what's wrong?
  • Are you getting any error status returned?
  • Have you tried a simple project with just the sensor - without TouchGfx?

Plus:

  • Can you get it to work on any other IC2 ?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Madhusudan
Associate
July 27, 2022

Yes address is correct, both pins are pullups and there si no conflict in Disco board they are free pins

Andrew Neil
Super User
July 27, 2022

@Madhusudan​ "both pins are pullups"

What pullups are you using, exactly?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Pavel A.
July 29, 2022

The Sensirion is almost a normal I2C device, should work just fine with STM32.

HAL_I2C_Mem_Read to read registers, HAL_I2C_Master_Receive to read data.