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

Program only starts when sensor is not attached #3

Open
Git572 opened this issue Apr 6, 2023 · 17 comments
Open

Program only starts when sensor is not attached #3

Git572 opened this issue Apr 6, 2023 · 17 comments

Comments

@Git572
Copy link

Git572 commented Apr 6, 2023

If I try to start the program with the weight sensor attached there are two beep sounds but nothing visible happens.
The program starts right into the gui without the sensor attached, but with the Warning: "Could not detect weight sensor! Please connect a fingerboard to your computer." Which is correct :-)

If I can do anything to help debug this problem, please let me know.

Ulrich

--
Running on Windows 11 Home Edition 22H2, aktuelle Updates

@OddgitHub
Copy link
Owner

OddgitHub commented Apr 6, 2023

Hi Ulrich,

thank you for your message.

Just a couple of questions:

  • Are you using the exe file to start the app (not the Python script)?
  • What hardware setup do you have (USB interface/load-cell module)? Does the MCP2221 show up in your devices as shown here:
    Hardware
  • If you're using the latest software version 1.2.1, a logfile is created in this folder:
    C:\Users\yourusername\AppData\Local\pbulling\CriticalForce\debug.log

Could you please send me this logfile? Just in case you don't see the "AppData" folder: It's a hidden folder, therefore you must enable hidden folders in the Explorer.

Best regards
Philipp

@Git572
Copy link
Author

Git572 commented Apr 6, 2023

Hi Philipp,
thanks for your quick response.
Yes, I use the exe-file. I saw today, that you launched a new version and tried it before starting the issue. The log is touched when starting CriticalForce.exe with or without sensor (timestamp gets updated) but stays empty anyway.
debug.log

The MCP2221A gets recognised and listed as I plug it in.
grafik

I had the opportunity to try it on an old laptop. Where everything works fine.
I'll test to start it in a new account tomorrow.

Best regards
Ulrich

@OddgitHub
Copy link
Owner

Hi Ulrich,

okay, good to hear that the hardware is working with an other laptop. This means that it's unlikely to be a hardware issue.

Are both laptops you've tried running Windows 11? To be honest, I've only tried it on Windows 10 so far.

I've build a Debug version of the application. This is exactly the same software as version 1.2.1, except that a terminal opens as soon as the app is started. Could you please check, if there are any error messages shown in the terminal?
Critical Force Debug Version

Thanks a lot for your effort and sorry for the inconvenience.

Best regards
Philipp

@Git572
Copy link
Author

Git572 commented Apr 7, 2023

Send without seeing your answer first :-(
I'l try the Debug version. Thanks so much for your effort.

Good Morning Philipp,

I didn't tell the complete hardware yet: Load cell --> NAU7882 --> MCP2221 --> USB
On the old laptop where it is working there is Windows 10 professionel and USB 2.0

On the desktop computer where CriticalForce.exe does only start without sensor it's Windows 11 home. Tried USB 2.0 and 3.0.
The new user didn't help either. Using "compatibility mode Windows 8" didn't make no difference.

Best regards
Ulrich

@Git572
Copy link
Author

Git572 commented Apr 7, 2023

Hi Philipp,

I'm doing now everything with your Debug version on Windows 11. Not depending if the sensor is plugged in the debug.log always gets touched but stays empty.

Starting with sensor attached:
debug.log gets touched, terminal is opening, blinking cursor but nothing else
Task-Manager shows two background processes of the CriticalForce_DEBUG.exe. One with 2.1 MB RAM usage and on with ~54 MB RAM usage.
waited for five minutes
After closing the terminal the bigger background process stays alive and I can't kill it within the task manager.
Everything reproducible.

Starting without sensor attached:
app starts immediately, process is listed as "App", and there is one background process. Both closing when closing the app.

Started out of a terminal with ".\CriticalForce_DEBUG.exe" the results are the same.

I compared it with the old laptop with windows 10. Here are, as you will know, a background process and one foreground process. Both of them terminating when closing the app.

Best regards
Ulrich

@OddgitHub
Copy link
Owner

Hi Ulrich,

that is very strange. I've got no idea, whats happening here. I've built another debug version, where I've manually added some print statements. Ideally, the terminal output should look like this:
Terminal

Could you please tell me, up to which comment/number it is working for you?

Best regards
Philipp

@Git572
Copy link
Author

Git572 commented Apr 9, 2023 via email

@Git572
Copy link
Author

Git572 commented Apr 17, 2023

Hi Philipp,

sorry, was getting home late yesterday.
Just tested your new debug version 2.
grafik

As you can see, it stopped after "02 - Import board".
I could see the device (MCP2221) in the device list, but it disappears for a split second, when I start the CritiicalForce_DEBUG2.exe right after the messages come visible in the terminal.

Best regards
Ulrich

@OddgitHub
Copy link
Owner

I think that the device disappears should be no problem, this also happens on my computer.

Unfortunately, I've got no idea, whats happening here. You said, the NAU7802 is connected to the MCP2221 via the Qwiic connector and the setup is working fine on an other computer?

@Git572
Copy link
Author

Git572 commented Apr 19, 2023

Hi Philipp,

sorry, was getting home late yesterday.
Just tested your new debug version 2.
grafik

As you can see, it stopped after "02 - Import board".
I could see the device (MCP2221) in the device list, but it disappears for a split second, when I start the CritiicalForce_DEBUG2.exe right after the messages come visible in the terminal.

Best regards
Ulrich

@Git572
Copy link
Author

Git572 commented Apr 19, 2023

Hi Philipp,

the Sensor is this one
then comes the "Adafruit NAU7802 24-Bit ADC Compatible with Arduino STEMMA QT Qwiic 4538"
Connected via: SF14426 SparkFun 4pin 1mm pitch JST Qwiic Cable - 50mm QITA Angebots-Nr.: 353139031770
to the "Adafruit MCP2221A Breakout - General Purpose USB zu GPIO ADC I2C"

and yes, it works o.K. on my old laptop with windows 10, which is nearly used to capacity just running windows :-)

Do you think it would help anything to run the debug version from source per "python start.py"? The normal v1.2.1 didn't give any output on the terminal (but I think that's how it is written).

Best regards
Ulrich

@OddgitHub
Copy link
Owner

Yes, it could be helpful, if you would run the app directly as Python script. Are you familiar with Python?

@Git572
Copy link
Author

Git572 commented Apr 23, 2023

I started a little bit into python a few years ago. To say I'm familiar would be to much. But it's an object orientated language - I'll try my best :-)
So far, I installed Visual Studio on the Computer with Windows 11 and "run" the program line by line.
It stops in sensor.py at line 48 trying to execute import board. Which is an external python module as an inerface for the arduino, if I got this right.

I'd say, tell me what you need / want me to do and I can tell you if I'm familiar enough :-)

P.S. Running scripts from a terminal would be also o.K. for me, I'm not glued to Visual Studio.

@OddgitHub
Copy link
Owner

The problem is that "import board" loads an external module. So it seems to be a problem with the MCP2221A, not with the Critical Force software itself. Not sure, how we can debug this.

One issue could be, that setting the Environment Variables fails. You could open a terminal and navigate to the folder with the "start.py" script.

Then type the following in the command line:
set BLINKA_MCP2221=1

Next start the script with
python start.py

If that doesn't help, you could check out this documentation, on how to setup the MCP2221A

@Git572
Copy link
Author

Git572 commented Apr 29, 2023

Setting the BLINKA_MCP2221 to 1 didn't help.
I added a line to sensor.py
print(os.environ['BLINKA_MCP2221'])
right bevor the
import board
which gives me (in a new opened terminal)
>python3 start.py
01 - Set environment variable
02 - Import board
1
So the BLINK_MCP2221 is set alright.

O.k. going to your link:
> set BLINKA_MCP2221=1
> python
>>> import hid
>>> hid.enumerate()
[long list with the MCP2221 in it]
>>> device = hid.device()
>>> device.open(0x04D8, 0x00DD)
>>> import os
>>> os.environ["BLINKA_MCP2221"]
'1'
>>> import board

here comes one beep upper->lower, then lower->upper, then the console stops and isn't accessible any more.
The same happens trying to import digitalio.

@OddgitHub
Copy link
Owner

Okay, thanks for trying this.

Unfortunately, I'm afraid that I'm not able to help you. It seems to be a problem with the MCP2221A.

Could you maybe post your problem in the adafruit forum?

@Git572
Copy link
Author

Git572 commented May 23, 2023

Sorry, I'm very bussy these days, but I will post it in the adafruit forum

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