Add timed read for smartcards + littles changes #160
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Here's a patch adding a command to receive a smartcard message with a timeout.
With the existing code, a successful read can only be achieved by specifying the exact number of characters (or less). This works:
But not this:
Of course, ATR is just an example, we don't always know the size of the data returned by the card.. So I added a new
tread
(timed read) command and atimeout
parameter. And now we can do this:Here, after the ATR, I selected the application on the smartcard (NXP J2A081, T=1 protocol) and used an APDU for a counter reading.
I have also configured a pull-up resistor on PA7 so that the normally closed contactor on the card reader opens and
query
displaysCD=1
when the card is present.Finally, the default communication speed should be 9408 bps because (1/((1/3500000)*372)). 9600 bps is a rounding-off that works but the ETU is normally 106µs with a 3.5 MHz clock.
Perhaps timeout read could be interesting for other buses too.