288 lines
13 KiB
HTML
288 lines
13 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.9.1"/>
|
|
<title>discoverpixy: Smartcard mode functions</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { init_search(); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">discoverpixy
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.9.1 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">Smartcard mode functions<div class="ingroups"><a class="el" href="group___s_t_m32_f4xx___std_periph___driver.html">STM32F4xx_StdPeriph_Driver</a> » <a class="el" href="group___u_s_a_r_t.html">USART</a> » <a class="el" href="group___u_s_a_r_t___private___functions.html">USART_Private_Functions</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Smartcard mode functions.
|
|
<a href="#details">More...</a></p>
|
|
<div class="dynheader">
|
|
Collaboration diagram for Smartcard mode functions:</div>
|
|
<div class="dyncontent">
|
|
<center><table><tr><td><img src="group___u_s_a_r_t___group6.png" border="0" alt="" usemap="#group______u__s__a__r__t______group6"/>
|
|
<map name="group______u__s__a__r__t______group6" id="group______u__s__a__r__t______group6">
|
|
<area shape="rect" id="node2" href="group___u_s_a_r_t___private___functions.html" title="USART_Private_Functions" alt="" coords="5,5,180,32"/></map>
|
|
</td></tr></table></center>
|
|
</div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:gac4a35c6acd71ae7e0d67c1f03f0a8777"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___u_s_a_r_t___group6.html#gac4a35c6acd71ae7e0d67c1f03f0a8777">USART_SetGuardTime</a> (<a class="el" href="struct_u_s_a_r_t___type_def.html">USART_TypeDef</a> *USARTx, uint8_t USART_GuardTime)</td></tr>
|
|
<tr class="memdesc:gac4a35c6acd71ae7e0d67c1f03f0a8777"><td class="mdescLeft"> </td><td class="mdescRight">Sets the specified USART guard time. <a href="#gac4a35c6acd71ae7e0d67c1f03f0a8777">More...</a><br /></td></tr>
|
|
<tr class="separator:gac4a35c6acd71ae7e0d67c1f03f0a8777"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gabd1347e244c623447151ba3a5e986c5f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___u_s_a_r_t___group6.html#gabd1347e244c623447151ba3a5e986c5f">USART_SmartCardCmd</a> (<a class="el" href="struct_u_s_a_r_t___type_def.html">USART_TypeDef</a> *USARTx, FunctionalState NewState)</td></tr>
|
|
<tr class="memdesc:gabd1347e244c623447151ba3a5e986c5f"><td class="mdescLeft"> </td><td class="mdescRight">Enables or disables the USART's Smart Card mode. <a href="#gabd1347e244c623447151ba3a5e986c5f">More...</a><br /></td></tr>
|
|
<tr class="separator:gabd1347e244c623447151ba3a5e986c5f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga62e22f47e38aa53f2edce8771f7a5dfa"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group___u_s_a_r_t___group6.html#ga62e22f47e38aa53f2edce8771f7a5dfa">USART_SmartCardNACKCmd</a> (<a class="el" href="struct_u_s_a_r_t___type_def.html">USART_TypeDef</a> *USARTx, FunctionalState NewState)</td></tr>
|
|
<tr class="memdesc:ga62e22f47e38aa53f2edce8771f7a5dfa"><td class="mdescLeft"> </td><td class="mdescRight">Enables or disables NACK transmission. <a href="#ga62e22f47e38aa53f2edce8771f7a5dfa">More...</a><br /></td></tr>
|
|
<tr class="separator:ga62e22f47e38aa53f2edce8771f7a5dfa"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<p>Smartcard mode functions. </p>
|
|
<pre class="fragment"> ===============================================================================
|
|
##### Smartcard mode functions #####
|
|
===============================================================================
|
|
[..]
|
|
This subsection provides a set of functions allowing to manage the USART
|
|
Smartcard communication.
|
|
[..]
|
|
The Smartcard interface is designed to support asynchronous protocol Smartcards as
|
|
defined in the ISO 7816-3 standard.
|
|
[..]
|
|
The USART can provide a clock to the smartcard through the SCLK output.
|
|
In smartcard mode, SCLK is not associated to the communication but is simply derived
|
|
from the internal peripheral input clock through a 5-bit prescaler.
|
|
[..]
|
|
Smartcard communication is possible through the following procedure:
|
|
(#) Configures the Smartcard Prescaler using the USART_SetPrescaler() function.
|
|
(#) Configures the Smartcard Guard Time using the USART_SetGuardTime() function.
|
|
(#) Program the USART clock using the USART_ClockInit() function as following:
|
|
(++) USART Clock enabled
|
|
(++) USART CPOL Low
|
|
(++) USART CPHA on first edge
|
|
(++) USART Last Bit Clock Enabled
|
|
(#) Program the Smartcard interface using the USART_Init() function as following:
|
|
(++) Word Length = 9 Bits
|
|
(++) 1.5 Stop Bit
|
|
(++) Even parity
|
|
(++) BaudRate = 12096 baud
|
|
(++) Hardware flow control disabled (RTS and CTS signals)
|
|
(++) Tx and Rx enabled
|
|
(#) POptionally you can enable the parity error interrupt using the USART_ITConfig()
|
|
function
|
|
(#) PEnable the USART using the USART_Cmd() function.
|
|
(#) PEnable the Smartcard NACK using the USART_SmartCardNACKCmd() function.
|
|
(#) PEnable the Smartcard interface using the USART_SmartCardCmd() function.
|
|
|
|
Please refer to the ISO 7816-3 specification for more details.
|
|
|
|
-@- It is also possible to choose 0.5 stop bit for receiving but it is recommended
|
|
to use 1.5 stop bits for both transmitting and receiving to avoid switching
|
|
between the two configurations.
|
|
-@- In smartcard mode, the following bits must be kept cleared:
|
|
(+@) LINEN bit in the USART_CR2 register.
|
|
(+@) HDSEL and IREN bits in the USART_CR3 register.
|
|
-@- Smartcard mode is available on USART peripherals only (not available on UART4
|
|
and UART5 peripherals).</pre> <h2 class="groupheader">Function Documentation</h2>
|
|
<a class="anchor" id="gac4a35c6acd71ae7e0d67c1f03f0a8777"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void USART_SetGuardTime </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_u_s_a_r_t___type_def.html">USART_TypeDef</a> * </td>
|
|
<td class="paramname"><em>USARTx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>USART_GuardTime</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Sets the specified USART guard time. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">USARTx</td><td>where x can be 1, 2, 3 or 6 to select the USART or UART peripheral. </td></tr>
|
|
<tr><td class="paramname">USART_GuardTime</td><td>specifies the guard time. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">None</td><td></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gabd1347e244c623447151ba3a5e986c5f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void USART_SmartCardCmd </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_u_s_a_r_t___type_def.html">USART_TypeDef</a> * </td>
|
|
<td class="paramname"><em>USARTx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">FunctionalState </td>
|
|
<td class="paramname"><em>NewState</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Enables or disables the USART's Smart Card mode. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">USARTx</td><td>where x can be 1, 2, 3 or 6 to select the USART or UART peripheral. </td></tr>
|
|
<tr><td class="paramname">NewState</td><td>new state of the Smart Card mode. This parameter can be: ENABLE or DISABLE. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">None</td><td></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga62e22f47e38aa53f2edce8771f7a5dfa"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void USART_SmartCardNACKCmd </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="struct_u_s_a_r_t___type_def.html">USART_TypeDef</a> * </td>
|
|
<td class="paramname"><em>USARTx</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">FunctionalState </td>
|
|
<td class="paramname"><em>NewState</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Enables or disables NACK transmission. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">USARTx</td><td>where x can be 1, 2, 3 or 6 to select the USART or UART peripheral. </td></tr>
|
|
<tr><td class="paramname">NewState</td><td>new state of the NACK transmission. This parameter can be: ENABLE or DISABLE. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="retval"><dt>Return values</dt><dd>
|
|
<table class="retval">
|
|
<tr><td class="paramname">None</td><td></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Sun May 10 2015 15:15:20 for discoverpixy by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.9.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|