LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview connection with STM32 via I2C.

what are the approaches are there to connect labview with STM32 via I2C?
i have converter to connect STM32 to my PC.
I'm trying VISA also!
are there any other approaches?

0 Kudos
Message 1 of 21
(457 Views)

Hi Anup,

 


@AnupSW13 wrote:

I'm trying VISA also!
are there any other approaches?


Why don't you just use VISA?

(Is this related with your other thread? Why don't you answer our questions in that thread?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 21
(453 Views)

yeah, I know i can use VISA but i wanted to know all approaches we can use and figure out which will be the best.
it is related to previous question , I can use PyVISA also . I wanted to know there are any other function specific for I2C like VISA.

0 Kudos
Message 3 of 21
(434 Views)

Hi Anup,

 


@AnupSW13 wrote:

I wanted to know there are any other function specific for I2C like VISA.


When you use dedicated I2C hardware from NI then they will come with dedicated driver routines for I2C communication…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 21
(428 Views)

im using convert usb to i2c.
but it shows as ASRL6::INSTR com6 under devices and interfaces.
so when im trying to read data from stm32 to labview its not receiving any data.

 

0 Kudos
Message 5 of 21
(425 Views)

Hi Anup,

 


@AnupSW13 wrote:

but it shows as ASRL6::INSTR com6 under devices and interfaces.
so when im trying to read data from stm32 to labview its not receiving any data.


So you have a virtual COM port and should use VISA functions to communicate over this port.

The port itself will not "create" any data by itself, it will only handle data you send to or receive from your µC!

 

You need to follow what is explained in this excellent video

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 21
(416 Views)

Your converter is most likely an FTDI 232 based device (other manufacturers could be possible and while their detail implementation differs from the one used by FTDI, the main principle is the same).

 

Most FTDI chips support both a virtual UART mode or a custom serial interface mode. The way those interfaces are accessed is however different. For the virtual UART mode you install the FTDI VCM driver and the device presents itself as a serial port to the system. But this serial port does not have a I2C or SPI translation mode (that you would have to program with specific commands send over the serial port) but instead only supports UART mode of the chip.

 

To access the other functionality you need to use the FTDI D2XX driver instead and then can access a so called MPSSE subsystem that implements I2C or SPI or other more bit-bang based methods. That is just to explain that with FTDI chips at least, there is no way to control the I2C functionality through the serial port interface mode. You must use the D2XX driver instead.

 

Other USB to parallel/serial interface converters use different ways, but the principle is usually the same. Having an USB to Virtual Comm Port interface with an extra Virtual Comm to I2C implementation requires much more intelligence on the interface chip. Possibly a Microchip PIC based interface could do that, but that easily costs a dollar more than an FTDI chip and that's a major expense in the market of such USB adapters. Also such an interface would require specific serial commands to program the according interface mode, and have a potentially whacky interface to switch between interface control mode and interface passthrough mode.

Rolf Kalbermatter
My Blog
Message 7 of 21
(398 Views)

I tried using  D2XX driver and D2xx labview library . but I'm getting so many errors.Screenshot (6).pngScreenshot (7).png

0 Kudos
Message 8 of 21
(354 Views)

Hi Anup,

 


@AnupSW13 wrote:

I tried using  D2XX driver and D2xx labview library . but I'm getting so many errors


Fix the broken dependency - as the error message says…

 

Did you install all the needed drivers (correctly)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 21
(343 Views)

First: Is your USB to I2C adapter using an FTDI chip? If it isn’t you can try to use the D2XX driver until hell freezes over but never will get anything but errors!

 

Second: Posting images of your code is usually not very useful. But it seems you didn’t install the FTDI driver on your system so the necessary DLLs are not present on your system.

 

Third: Implementing I2C mode directly on the D2XX level is a nice exercise but not a suitable one for someone who is just starting with LabVIEW, serial communication and controlling hardware in general. FTDI has additional driver DLLs that use the D2XX driver to access the MPSSE subsystem. One is for SPI, the other for I2C. There are threads on lavag.org for them that contain VIs to access that DLLs. Read all the threads completely, those VIs have some errors and need to be fixed to work properly.

Rolf Kalbermatter
My Blog
Message 10 of 21
(341 Views)