Giter Club home page Giter Club logo

Comments (9)

frami avatar frami commented on June 16, 2024 1

The following PR #115 solve the problem.

from adafruit-fingerprint-sensor-library.

ladyada avatar ladyada commented on June 16, 2024

could be a regression failure. that said, softwareserial is pretty good at 57600 and we test at that speed no problem!

from adafruit-fingerprint-sensor-library.

alastaira avatar alastaira commented on June 16, 2024

Thanks for the quick response!
I'll have a check back through and see if there have been any commits that could have caused that function to regress - from what I can see in the (minimal!) datasheet, it certainly seems like it should work. I guess because there were no examples demonstrating its usage I just wondered whether there were any known issues, but I'll investigate and comment back if I find anything.

I find that 57600 baud for SoftSerial only works if you have a very simple sketch (and not much data being transmitted) - but as soon as you have any non-trivial logic in loop() you risk corrupted data. Part of this sketch involves transferring the library of fingerprint templates, so I'd prefer it to be robust. I could switch to AltSoftSerial, which is more reliable at higher speeds, but thought I'd try to drop to 9600 as it seemed like it should be easy to do! ;)

from adafruit-fingerprint-sensor-library.

alastaira avatar alastaira commented on June 16, 2024

The following PR #115 solve the problem.

Oh, good spot - can't believe I missed that! Thankyou :)

from adafruit-fingerprint-sensor-library.

henfri avatar henfri commented on June 16, 2024

Thanks @frami !
I tried it with this code:

    finger.begin(57600);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);
    Serial.println("Set Baudrate. return value: (0 is ok, 1 is not ok)");
    String ret = "";
    ret=finger.setBaudRate(FINGERPRINT_BAUDRATE_9600);
    Serial.println(ret);
    Serial.println("Baudrate");
    finger.begin(9600);
    Serial.println(finger.baud_rate);

it returns:

Baudrate
57600
Set Baudrate. return value:
0
Baudrate
57600
Found fingerprint sensor!

So, it seems that the Baudrate remains at 57600 baud.
What am I doing wrong?

I also tried:

    finger.begin(9600);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);
    Serial.println("Set Baudrate. return value: (0 is ok, 1 is not ok)");
    String ret = "";
    ret=finger.setBaudRate(FINGERPRINT_BAUDRATE_9600);
    finger.begin(FINGERPRINT_BAUDRATE_9600);
    Serial.println(ret);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);

and get

Baudrate
57600
Set Baudrate. return value: (0 is ok, 1 is not ok)
0
Baudrate
57600

Apart from this: what is the idear behind set_baudrate? Will it be stored in the Sensor?

The reason I ask: My cable is a bit longer. Thus, the connection at the high baud rate may fail. I rely on the fact that the connection would always be done at 9600 baud.

Best regards,
Hendrik

from adafruit-fingerprint-sensor-library.

alastaira avatar alastaira commented on June 16, 2024

Thanks @frami ! I tried it with this code:

    finger.begin(57600);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);
    Serial.println("Set Baudrate. return value: (0 is ok, 1 is not ok)");
    String ret = "";
    ret=finger.setBaudRate(FINGERPRINT_BAUDRATE_9600);
    Serial.println(ret);
    Serial.println("Baudrate");
    finger.begin(9600);
    Serial.println(finger.baud_rate);

it returns:

Baudrate
57600
Set Baudrate. return value:
0
Baudrate
57600
Found fingerprint sensor!

So, it seems that the Baudrate remains at 57600 baud. What am I doing wrong?

I also tried:

    finger.begin(9600);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);
    Serial.println("Set Baudrate. return value: (0 is ok, 1 is not ok)");
    String ret = "";
    ret=finger.setBaudRate(FINGERPRINT_BAUDRATE_9600);
    finger.begin(FINGERPRINT_BAUDRATE_9600);
    Serial.println(ret);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);

and get

Baudrate
57600
Set Baudrate. return value: (0 is ok, 1 is not ok)
0
Baudrate
57600

Apart from this: what is the idear behind set_baudrate? Will it be stored in the Sensor?

The reason I ask: My cable is a bit longer. Thus, the connection at the high baud rate may fail. I rely on the fact that the connection would always be done at 9600 baud.

Best regards, Hendrik

The PR has not been implemented into the master branch yet, so did you apply the changes yourself?

from adafruit-fingerprint-sensor-library.

henfri avatar henfri commented on June 16, 2024

Sorry, yes I should have mentioned that.

from adafruit-fingerprint-sensor-library.

henfri avatar henfri commented on June 16, 2024

Hello,

this was the problem:

    ret=finger.setBaudRate(FINGERPRINT_BAUDRATE_9600);
    finger.begin(FINGERPRINT_BAUDRATE_9600);

FINGERPRINT_BAUDRATE_9600 is 0x1 and used to SET the baudrate.
To connect, you need finger.begin(9600).

Nevertheless, I am a bit confused now....

    finger.begin(9600);
    Serial.println("Baudrate");
    Serial.println(finger.baud_rate);

returns

Baudrate
57600

I finally found out, that
finger.getParameters();
needs to be called, before the baudrate is correctly reported.

Is that the intended behaviour? I would not expect that a wrong value is returned, if I do not call getParameters first.
I would expect "None" or so.

Anyway, for me it works now :-)

Please include the PR in the next release!

from adafruit-fingerprint-sensor-library.

caternuson avatar caternuson commented on June 16, 2024

Closing. Should be fixed by #115.

from adafruit-fingerprint-sensor-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.