Jump to main content

##

# 2.110.37 SERCOMx_ISO7816_Xfr_Block_Tpdu

## C

    /* x = SERCOM instance number */

    uint16_t SERCOM3_ISO7816_Xfr_Block_Tpdu( uint8_t *apdu_cmd_buffer, uint8_t *apdu_res_buffer, const size_t apdu_cmd_length )

## Summary

This API write data and reads the response from ISO7816 Smartcard

## Description

This API allows the application to send commands and read back its response. Commands like configuration, data write, data read can be sent to card, it executes the command and its response (Status Words) is returned back so the API reads back the response and updates to apdu_res_buffer paramenter. It returns the byte count it received as response.

## Precondition

Card_Detect, Cold/Warm_Reset functions must be called. These function calls ensure the device is up and running in its normal state.

## Parameters

Param | Description
apdu_cmd_buffer | Pointer to the command message buffer. This contains the data to be transmitted.
apdu_res_buffer | Pointer to the response message buffer. It contains the response data from card.
apdu_cmd_length | No of bytes in apdu_cmd_buffer to be transmitted to card.

## Returns

The API returns the number of bytes it received from card.

## Example

    #define RX_BUFFER_SIZE 256
    unsigned char WriteCommand[] = {0x00, 0xB4, 0x00, 0x0A, 0x02, 0x77, 0x55};
    uint8_t resp_rcvd[RX_BUFFER_SIZE];
    uint16_t resp_bytes;

    resp_bytes = SERCOM3_ISO7816_Xfr_Block_Tpdu(WriteCommand, resp_rcvd, 7);

## Remarks

None