Closed baku-hatsu closed 5 years ago
No, I said to provide a screenshot of the python console itself after the image is done being transferred. Dont paste the text. Upload an image of the console.
Also turn off debug, when you do this
When i turn off debuging the python exe doesnt work: it creates blank image, with no content.
With debugging is open, i get this: This creates image as seen in above comments
Okay. So this is the latest version of the library, right? And in the first case, you get "Timeout!" after waiting for a few seconds?
The "Timeout!" doesn't show immediately the image stream begins?
Yes it dosnt show immediately, it takes like 10 or little more seconds. And this is latest version of library, with R551 uncommented line
It seems your module has a different image size of 192x192. I've pushed a change to the python script. Assign True to FPM_R551_MODULE at the top and run it. Let me know how it works out
It's important that debugging is turned off for this sketch because the debug messages go through the same Serial port as the image stream, so all those debug strings end up getting written to the bmp file, which isnt what you want.
I get same error: Did you recompiled python exe or it read from that file?
No I haven't rebuilt the exe. Can you run the python script?
I edite phyton file, but i dont see changes, so i assume your changes is only on file, not on .exe, to build exe from python file i cant yet, i had lots of trouble with python on Windows 10, would be good if you could build it
Ok nevermond, i did run python file, and i got image however it doesnt look as expected either:
Let me see the console output.
According to documentation image buffer size can be 192x192 with depth of 8
Yeah, made a mistake. In the python code, change the WIDTH = 96 to 192.
I tried that myself, i still get error. Console looks like this: Image looks like this:
That looks like the very last packet. Can you try running it again? I want to see if the failure is consistent
I think you didnt change this line FPM_R551_MODULE = False
to True
like I said. The arduino ends up waiting forever for another packet, when the image stream is already completed.
Two tries out of five did not gave error message, however rest of the tries gave same error message. All scanned images was same size. Code is:
What is the exact size? Check the properties of the generated image and send a screenshot of that. Also a screenshot of the console output when there was no error.
Scanned image size is 192x192 pixels Console look like this: port is COM3 and bound is 57600
As well im using python -m pip install pyserial as for serial import for python, that maybe be other kind of serial?
No, its fine. Run the sketch, but use the serial monitor instead.
Looks like the problem isnt with the script, its with the module not sending FPM_ENDDATAPACKET to show that its done.
You haven't made any changes to the image_to_pc sketch, right?
No, i havent, only to FPM.h library, where i uncommented one line of code / R551 is different in a few ways (no high-speed search, off-by-one template indices) uncomment this line if you have one of those /
Okay. Comment out line 663 outStream->write(byte);
in FPM.cpp. Enable debugging. Then run the sketch with the serial monitor alone. Let me see what is printed in the last few packets of the image, before the error shows up.
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x2 [+]Length: 128 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 80 EF 1 FF FF FF FF 8 0 82 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF Read data failed: -1
Error receiving packet 80
And this is like 1/3 shorter than rest
At beginning it seems to get normal packages but on the end only FF's appear
The FFs arent a problem, they just show that most of the image is white pixels as expected. Comment out these debug lines in the code:
[+]Got header
[+]Address: 0xFFFFFFFF
As well as line 670: FPM_DEBUG_HEX(byte); FPM_DEBUG_PRINT(" ");
I want only the PID and length to be printed.
Before stream: [+]PID: 0x7 [+]Length: 1
On the stream: [+]PID: 0x2 [+]Length: 128 Read data failed: -1
Error receiving packet 144
Run it a few more times, check that it gives the same result and stops at the same packet
Yes its always same packet
And this is the very last packet always:
[+]PID: 0x2
[+]Length: 128
Can you check if any packet has a PID of 0x8?
There is no packet with PID 0x8
At line 662 in FPM.cpp, change this:
if (outStream != NULL) {
outStream->write(byte);
}
to
if (outStream != NULL) {
outStream->write(byte);
chksum += byte;
}
and this at 684:
if (outStream == NULL && to_check != chksum)
to:
if (to_check != chksum)
Let me know if it prints "Wrong chksum" for any packet.
outStream->write(byte);
should still be commented out as before.
It prints that for every stream packet
[+]Wrong chksum
Read data failed: -1
Error receiving packet 0
What of the PID and length? There was no wrong chksum in the earlier commands, right?
[+]Wrong chksum [+]PID: 0x2 [+]Length: 128
[+]Wrong chksum
Read data failed: -1
Error receiving packet 0
It was all the time while stream begin, before stream, there there was this: [+]Length: 1 [+]PID: 0x7
You mean, there was no "wrong chksum" before the stream began, but then after that, each packet has a wrong chksum? ALL the packets with wrong chksums have a PID of 0x2?
Yes
Uncomment line 670: FPM_DEBUG_HEX(byte); FPM_DEBUG_PRINT(" ");
and the other debug lines (Header and address only). I want to see the entire packet as its printed. Use pastebin.com to send a dump of everything printed in the serial monitor.
Also send a copy of your FPM.cpp in another paste.
https://pastebin.com/Xcpz16Vv the serial monitor https://pastebin.com/vZpz5D75 fpm.cpp file
Have you restarted the module, since you started using it to get images?
The packet length setting is being ignored for some reason and it could be because it hasn't taken hold yet.
Probably not, how do i reset it? using reset pin or just unplug?
python output: ----------Extract Fingerprint Image------------
Options: Press 1 to enter serial port settings Press 2 to scan a fingerprint and save the image Press 3 to view help Press 4 to exit
Enter Arduino serial port number: COM3 Enter serial port baud rate: 57600
Options: Press 1 to enter serial port settings Press 2 to scan a fingerprint and save the image Press 3 to view help Press 4 to exit
Enter filename/path of output file (without extension): asd SEND IMAGE TO PC test
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 1 0 [+]Read complete
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 17 0 0 0 0 0 1 F4 0 3 FF FF FF FF 0 2 0 6 [+]Read complete
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 17 0 0 0 0 0 1 F4 0 3 FF FF FF FF 0 2 0 6 [+]Read complete Found fingerprint sensor! Capacity: 500 Packet length: 128
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 1 0 [+]Read complete
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 17 0 0 0 0 0 1 F4 0 3 FF FF FF FF 0 2 0 6 [+]Read complete Packet length set to 128 bytes Waiting for a finger...
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 1 2 [+]Read complete
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 1 0 [+]Read complete Image taken
[+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x7 [+]Length: 1 0 [+]Read complete Starting image stream... Image saved as asd.bmp FF FF FF FF FF FF FF FF FF FF FF FF FF EF 1 FF FF FF FF 2 0 82 FF FF FF FF
Picture is this:
Arduino seriam monitor shows this: [+]Got header [+]Address: 0xFFFFFFFF [+]PID: 0x2 [+]Length: 128 ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮FF ⸮EF 1 ⸮FF ⸮FF ⸮FF ⸮FF 2 Read data failed: -1
Error receiving packet 67