cancel
Showing results for 
Search instead for 
Did you mean: 

ST Link virtual COM Port issue with Excel VBA but shown in other Terminal Software

Lutz_66
Associate II

Hello

I am encountering an issue with a code running on an STM32F4xxx board. The code is designed to perform a measurement, and I aim to transfer this data to a computer. While I can successfully receive the measurement using various terminal programs, I require the data to be imported into an Excel sheet. To facilitate this, I've developed a macro that extracts data from the serial interface.

However, I've encountered a problem where the data from the ST Link Virtual COM port isn't being received by Excel VBA, despite ensuring that all settings such as baud rate, parity, stop bits, and flow control are correctly configured.

Concurrently, I've conducted a test using an Arduino, where I've programmed it to transmit identical data (excluding measurements, which remain constant). Interestingly, when I switch the COM port to that of the Arduino, Excel successfully receives the data.

This leads me to speculate whether there's a discrepancy between the virtual COM port of the STM32F4 Nucleo board and that of an Arduino, particularly in how software addresses the COM port under Windows.

Please note that the PC where the data reception application runs only supports the execution of VBA macros within Excel, and no additional software can be installed.

Thank you for your assistance in resolving this matter.

Best regards,

Lutz

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Evangelist III

@Lutz_66 wrote:

This leads me to speculate whether there's a discrepancy between the virtual COM port of the STM32F4 Nucleo board and that of an Arduino, particularly in how software addresses the COM port under Windows.


That's highly unlikely: as far as Windows apps can see, they're all just COM ports - the apps can't even distinguish a VCP from a real COM port.

There must be something about your STM32 code that is formatting the data (slightly) differently from the Arduino.

First thing I'd look at would be your line endings.

 


@Lutz_66 wrote:

I can successfully receive the measurement using various terminal programs


Have you tried any terminals that can show you the full binary data that's being sent - including control codes (CR, LF, etc) ?

RealTerm is one that can do this ...

 

Addendum:

Timing would be another thing

 


@Lutz_66 wrote:

I've conducted a test using an Arduino


What Arduino did you use?

An STM32F4 would likely out-perform an AVR-based Arduino...

 

View solution in original post

3 REPLIES 3
Andrew Neil
Evangelist III

@Lutz_66 wrote:

This leads me to speculate whether there's a discrepancy between the virtual COM port of the STM32F4 Nucleo board and that of an Arduino, particularly in how software addresses the COM port under Windows.


That's highly unlikely: as far as Windows apps can see, they're all just COM ports - the apps can't even distinguish a VCP from a real COM port.

There must be something about your STM32 code that is formatting the data (slightly) differently from the Arduino.

First thing I'd look at would be your line endings.

 


@Lutz_66 wrote:

I can successfully receive the measurement using various terminal programs


Have you tried any terminals that can show you the full binary data that's being sent - including control codes (CR, LF, etc) ?

RealTerm is one that can do this ...

 

Addendum:

Timing would be another thing

 


@Lutz_66 wrote:

I've conducted a test using an Arduino


What Arduino did you use?

An STM32F4 would likely out-perform an AVR-based Arduino...

 


@Andrew Neil wrote:

@Lutz_66 wrote:

This leads me to speculate whether there's a discrepancy between the virtual COM port of the STM32F4 Nucleo board and that of an Arduino, .


That's highly unlikely:


You could rule it out by using a separate USB-to-UART converter, and swap that between the Arduino and the Nucleo

Lutz_66
Associate II

Yes you are right, I didn't think about that
Arduino end with \r\n and STM32 is only \n, no difference in terminal software but it is necessary for Excel VBA

thank you very much