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

serial speed for pn532 #708

Open
paweljasinski opened this issue Jan 15, 2024 · 5 comments
Open

serial speed for pn532 #708

paweljasinski opened this issue Jan 15, 2024 · 5 comments

Comments

@paweljasinski
Copy link

paweljasinski commented Jan 15, 2024

Are serial speeds other than 115200 supported when using pn532?
Both:
device.connstring = "pn532_uart:/dev/ttyUSB0:57600
and
device.connstring = "pn532_uart:/dev/ttyUSB0:460800
produce a code dump.

@NFC-funs
Copy link

NFC-funs commented Mar 7, 2024

hi,paweljasinski:
Speed value must be one of these constants: 9600 (default), 19200, 38400, 57600, 115200, 230400 or 460800.", uiPortSpeed); It's in the file “uart.c”.
But 115200 is the PN532's default value. If you want to use other baud, you must use "SetSerialBaudRate" command first.
image

@paweljasinski
Copy link
Author

To be sure I am not misunderstanding anything.

  • establish communication with the default 115200,
  • issue the SetSerialBaudRate
  • re-establish communication with a new speed

@NFC-funs
Copy link

Please refer to the diagram:
image
To be sure that the baud rate-"Real HSU Freq" error is not greater than 4%:
image

PN532 User Manual V0.2.pdf
PN532_C1.pdf

@paweljasinski
Copy link
Author

paweljasinski commented Mar 13, 2024

already have a basic communication with 230.4.

To be sure that the baud rate-"Real HSU Freq" error is not greater than 4%:
Do I have to adjust registers value (HSU_CNT and HSU_PRE) myself, or it happens as part of SetSerialBaudRate?

I have another question:
Once the comm speed is changed from default, it is persistent until reset or power cycle.
For now I am coding with assumption that libnfc works with the board after reset and starts with 115200 and changes to requested speed. The code is not trying to reestablished communication after program terminated but board did not get reset and is still using the altered speed.
Is this something you would considered to be acceptable in PR?

@NFC-funs
Copy link

Poll the command "SAMConfiguration" at different baud rates before communication, such as: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 03 FD D4 14 01 17 00, and receive the right ACK.

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