Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read serial port on Windows 10 #173

Open
AlexanderSveshnikov opened this issue Oct 15, 2024 · 5 comments
Open

Can't read serial port on Windows 10 #173

AlexanderSveshnikov opened this issue Oct 15, 2024 · 5 comments

Comments

@AlexanderSveshnikov
Copy link

Hello. I'm trying to use JSSC to communicate with my STM32 device via virtual serial port, but I can read data only under debug mode. When I switch into run-mode, no reading performed. I use netbeans 22, java se 22.0.2 on 64 bit machine.
And I use event listener to read data. What's wrong? Does anybody faced with this problem?

@tresf
Copy link

tresf commented Oct 15, 2024

Hi,

Although you may find others that have the same problem, it's difficult for a JSSC developer to reproduce the issue without some form of reproducible code snippet.

Can you provide a minimally reproducible code snippet that illustrates the issue? Even a very basic Netbeans project that illustrates the issue may suffice.

@AlexanderSveshnikov
Copy link
Author

numberaddition.zip
Here is my sources

@tresf
Copy link

tresf commented Oct 17, 2024

@AlexanderSveshnikov thanks for sharing the code. This code is not a minimally reproducible example as it 1,400 lines of code, which makes it a bit harder to understand what's going wrong with JSSC. Can you prepare a very simple example with JSSC that illustrates the problem?

[...] but I can read data only under debug mode. When I switch into run-mode, no reading performed.

When you say "debug mode", do you mean that you are placing the STM32 device into debug mode, or that you are running Netbeans in debug mode?

When you cannot read data, do you receive any information at all (console logs, symptoms, etc) that may allude to the problem?

@AlexanderSveshnikov
Copy link
Author

AlexanderSveshnikov commented Oct 17, 2024

When I say "Debug mode", I mean Netbeans in debug mode of course.
When I cannot read data, I receive information from Netbeans console log:

 public void serialEvent(SerialPortEvent event) {
    
            if (event.isRXCHAR()) {
                if (event.getEventValue() > 0) {
                    try {
                        System.out.println("Got reply");  //<- This is the message I can view in debug mode, but can't in run mode!

@tresf
Copy link

tresf commented Oct 17, 2024

When I say "Debug mode", I mean Netbeans in debug mode of course. When I cannot read data, I receive information from Netbeans console log: public void serialEvent(SerialPortEvent event) {

        if (event.isRXCHAR()) {
            if (event.getEventValue() > 0) {
                try {
                    System.out.println("Got reply");  //<- This is the message I can view in debug mode, but can't in run mode!

I'm not sure how the IDE's debug mode would impact the reliability of the library's behavior. Initial thoughts are that it will use a different compiled class cache, which may allude to the problem, but that's purely speculative. There may also be something about Java 22 that's causing something we haven't seen before.

I can fire up NetBeans on just about any OS and test the same version of JSSC against a serial device that I have locally to see if this is reproducible, but I would need a minimally reproducible code example, preferably a sample Netbeans project that I can use to click "Run" or "Debug" from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants