Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect STM32 via USB using virtual COM port

Highlighted

Hello Everyone!

 

I am trying to connect a STM32F401 via USB. Using other terminals the communication works fine. Now i want to implement it in LABVIEW 2017.

 

I started with installing the device driver from the ST for Virtual COM Port

 

device manager.PNGIn the device manager everything seems to work fine. But there is a problem accesing the device using MAX or VISA.

Visaic.PNGmax.PNGIt is not possible to open VISA Testpanel. Error Code reads as follows

Error opening resource:
ASRL5::INSTR

VISA: (Hex 0xBFFF0000) unknown systemerror (several errors).

 

Using the VISA driver wizard i got the message that the drivers are already installed porperly.

 

driverwizard.PNG

Using WIN10 64 bit

Labview 2017 32 bit

MAX 17.0

 

Any suggestions on how to continue? Can it be possible to acces the port in LABVIEW without having a proper VISA setup?

 

 

Thankful for any suggestion, Gu

0 Kudos
Message 1 of 8
(3,127 Views)

Hi,

 

did you walk through the forum discussion here? https://forums.ni.com/t5/LabVIEW/Reasons-for-Error-code-in-viWrite-0xBFFF0000/td-p/2101734

The error code is the same, and there are some suggestions how to proceed.

 

A proper VISA setup is mandatory for LabVIEW usage, as it works on the VISA drivers (ignoring stuff like self-written FPGA-based solutions).

 

Greetings

 

Stefan

0 Kudos
Message 2 of 8
(2,930 Views)

Hello GL_HEI,

I faced the same problem. the problem is in two parts.

First of all you should use the last BSP package for configuring the STM board. I am using stm cube with package stm32cube_fw_f3_v1.10. in addition update your compiler to the last version (as example Keil v5.26).
Give the USB driver in STM a proper time to configure as follow
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 2 */
HAL_Delay(2000);
Now in labview you will find your usb appear in NI MAX without any problem.
Notes
Update your NI VISA to the version 18 and installed driver.

Good Luck
Ibrahim I. N.STM32 LabVIEW17.PNG

 

Message 3 of 8
(2,214 Views)

I use System Workbench for STM32 and I did everything as you said.
I download latest version of BSP for my F4 board and also added HAL_Delay(2000).

Unfotunely for me the problem still occurs.

0 Kudos
Message 4 of 8
(2,039 Views)

Hi Kamil,

 

Did you ever resolve this issue? I am having the same problem.

0 Kudos
Message 5 of 8
(1,535 Views)
HI, Elar123

 

I think the problem is with windows 10 default COM port driver. I was able to properly connect STM32 via USB on windows 7. To do so you just need to install driver for USB stm32 from ST company website.

 

0 Kudos
Message 6 of 8
(1,527 Views)

I have been having a problem like you have described above and wanted to "bump" this post to see if anyone has been able to make any progress with this. With windows 7 going EOL that is not going to be a suitable option soon.

 

I am using an STM32F446RE running on System workbench and STM32Cube with everything updated to the latest versions. I have just updated to NI-Visa 18.5 but not having any luck.

0 Kudos
Message 7 of 8
(480 Views)

I managed to get a response on the ST forums if any one comes across this in the future.

 

https://community.st.com/s/question/0D50X0000BOvcxISQR/possible-stm32-usb-virtual-com-port-driver-bu...

 

Bob S (Community Member)

In your STM32 code look in usbd_cdc_if.c for CDC_SET_LINE_CODING and CDC_GET_LINE_CODING cases. There needs to be code to save the settings from the "set line" command, and return those saved settings in the "get line" command. Most HAL libraries don't have that code. If you search the forums for CDC_SET_LINE_CODING you should find examples of this. There is a USBD_CDC_LineCodingTypeDef in usbd_cdc.h that defines the data used in these commands.


0 Kudos
Message 8 of 8
(399 Views)