FTDI Community

General Category => Discussion - Software => Topic started by: DanTrotts on August 19, 2019, 07:05:25 PM

Title: Reading Temp/Hum from an SHT31-D on Linux via an FT232H interface
Post by: DanTrotts on August 19, 2019, 07:05:25 PM

I have an Adafruit FT232H board with a connected SHT31-D that I want to read the humidity and temperature from. I want to code this in C++ and not Python and I was wondering if anyone had a simple shell of a C or C++ program that would just show the basics of doing that. I have FTD2XX and libMPSSE-i2c libraries installed on Ubuntu 19.04 release.

I can see the FT232H and read its EEPROM. I know that I have to remove the ftdi_sio and usbserial drivers to be able to talk to it. Where I don't have any practical experience is talking through the FT232H to the SHT31-D using either D2XX or MPSSE with i2c or other protocols.

The SHT31-D is wired with ground, D0 to SCL and D1 tied to D2 going to SDA. I have python code that can read the temp and humidity but I just can't seem to compile a C or C++ program with the right library combinations to be able to make it work.

Any help or pointers would be appreciated.

P.S.  I have the following reply from support on the Adafruit support group:

     "by adafruit_support_mike on Mon Aug 19, 2019 5:40 am
      I'm afraid we don't have any C code for communicating with the FT232H. Maybe someone from the community will have more information."


Title: Re: Reading Temp/Hum from an SHT31-D on Linux via an FT232H interface
Post by: FTDI Community on August 20, 2019, 02:41:53 PM

Please have a look at the following application notes, which cover I2C examples:

https://www.ftdichip.com/Support/Documents/AppNotes/AN_113_FTDI_Hi_Speed_USB_To_I2C_Example.pdf (https://www.ftdichip.com/Support/Documents/AppNotes/AN_113_FTDI_Hi_Speed_USB_To_I2C_Example.pdf)
https://www.ftdichip.com/Support/Documents/AppNotes/AN_355_FT232H%20MPSSE%20Example%20-%20I2C%20Master%20Interface%20with%20Visual%20Basic.pdf (https://www.ftdichip.com/Support/Documents/AppNotes/AN_355_FT232H%20MPSSE%20Example%20-%20I2C%20Master%20Interface%20with%20Visual%20Basic.pdf)
https://www.ftdichip.com/Support/Documents/AppNotes/AN_411_FTx232H%20MPSSE%20I2C%20Master%20Example%20in%20Csharp.pdf (https://www.ftdichip.com/Support/Documents/AppNotes/AN_411_FTx232H%20MPSSE%20I2C%20Master%20Example%20in%20Csharp.pdf)

https://www.ftdichip.com/Support/Documents/AppNotes/AN_190_C232HM_MPSSE_Cable_in_USB_to_I2C_Interface.pdf (https://www.ftdichip.com/Support/Documents/AppNotes/AN_190_C232HM_MPSSE_Cable_in_USB_to_I2C_Interface.pdf)

The following will also be useful:
https://www.ftdichip.com/Support/Documents/AppNotes/AN_135_MPSSE_Basics.pdf (https://www.ftdichip.com/Support/Documents/AppNotes/AN_135_MPSSE_Basics.pdf)
https://www.ftdichip.com/Support/Documents/AppNotes/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf (https://www.ftdichip.com/Support/Documents/AppNotes/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf)

Best Regards,
FTDI Community