avrdude/atmel-docs/EDBG/protocoldocs/ch07s01s07.html

231 lines
34 KiB
HTML
Raw Permalink Normal View History

<!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 content="IE=edge" http-equiv="X-UA-Compatible" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>SPI Program Flash - - Atmel EDBG-based Tools Protocols</title><meta content="DocBook XSL Stylesheets V1.78.1" name="generator" /><link rel="home" href="index.html" title="Atmel EDBG-based Tools Protocols" /><link rel="up" href="ch07s01.html" title="SPI programming protocol commands" /><link rel="prev" href="ch07s01s06.html" title="SPI Chip Erase" /><link rel="next" href="ch07s01s08.html" title="SPI Read Flash" /><meta content="SPI Program Flash" name="Section-title" /><script type="text/javascript">
//The id for tree cookie
var treeCookieId = "treeview-10619";
var language = "en";
var w = new Object();
//Localization
txt_filesfound = 'Results';
txt_enter_at_least_1_char = "You must enter at least one character.";
txt_browser_not_supported = "JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.";
txt_please_wait = "Please wait. Search in progress...";
txt_results_for = "Results for: ";
</script><link type="image/x-icon" href="../favicon.ico" rel="shortcut icon" /><link href="../common/css/positioning.css" type="text/css" rel="stylesheet" /><link href="../common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css" type="text/css" rel="stylesheet" /><link href="../common/jquery/treeview/jquery.treeview.css" type="text/css" rel="stylesheet" /><style type="text/css">
#noscript{
font-weight:bold;
background-color:#55AA55;
font-weight:bold;
height:25spx;
z-index:3000;
top:0px;
width:100%;
position:relative;
border-bottom:solid 5px black;
text-align:center;
color:white;
}
input{
margin-bottom:5px;
margin-top:2px;
}
.folder{
display:block;
height:22px;
padding-left:20px;
background:transparent url(../common/jquery/treeview/images/folder.gif) 0 0px no-repeat;
}
.dochome{
display:block;
margin:10px 0 0 0;
padding-left:20px;
background:transparent url(../common/images/Library.png) 0 0px no-repeat;
}
.root{
display:block;
margin:10px 0 0 2px;
padding-left:20px;
background:transparent url(../common/images/Book_Open.png) 0 0px no-repeat;
}
.dochome a,
.root a {
text-decoration:none;
font-size:12px;
color:#517291;
}
span.contentsTab{
padding-left:20px;
background:url(../common/images/toc-icon.png) no-repeat 0 center;
}
span.searchTab{
padding-left:20px;
background:url(../common/images/search-icon.png) no-repeat 0 center;
}
/* Overide jquery treeview's defaults for ul. */
.treeview ul{
background-color:transparent;
margin-top:4px;
}
#webhelp-currentid{
background-color:#D8D8D8 !important;
}
.treeview .hover{
color:black;
}
.filetree li span a{
text-decoration:none;
font-size:12px;
color:#517291;
}
.filetree span.file {
background: url(../common/images/Document_Text.png) 0 0 no-repeat;
}
/* Override jquery-ui's default css customizations. These are supposed to take precedence over those.*/
.ui-widget-content{
border:0px;
background:none;
color:none;
}
.ui-widget-header{
color:#e9e8e9;
border-left:1px solid #e5e5e5;
border-right:1px solid #e5e5e5;
border-bottom:1px solid #bbc4c5;
border-top:4px solid #e5e5e5;
border:medium none;
background:#F4F4F4; /* old browsers */
background:-moz-linear-gradient(top, #F4F4F4 0%, #E6E4E5 100%); /* firefox */
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #F4F4F4), color-stop(100%, #E6E4E5)); /* webkit */
font-weight:none;
}
.ui-widget-header a{
color:none;
}
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default{
border:none;
background:none;
font-weight:none;
color:none;
}
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited{
color:black;
text-decoration:none;
}
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus{
border:none;
background:none;
font-weight:none;
color:none;
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active{
border:none;
background:none;
font-weight:none;
color:none;
}
.ui-state-active a,
.ui-state-active a:link,
.ui-state-active a:visited{
color:black;
text-decoration:none;
background:#C6C6C6; /* old browsers */
background:-moz-linear-gradient(top, #C6C6C6 0%, #D8D8D8 100%); /* firefox */
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #C6C6C6), color-stop(100%, #D8D8D8)); /* webkit */
-webkit-border-radius:15px;
-moz-border-radius:10px;
border:1px solid #f1f1f1;
}
.ui-corner-all{
border-radius:0 0 0 0;
}
.ui-tabs{
padding:.2em;
}
.ui-tabs .ui-tabs-panel {
padding-top: 6px;
}
.ui-tabs .ui-tabs-nav li{
top:0px;
margin:-2px 0 1px;
text-transform:uppercase;
font-size:10.5px;
}
.ui-tabs .ui-tabs-nav li a{
padding:.25em 2em .25em 1em;
margin:.5em;
text-shadow:0 1px 0 rgba(255, 255, 255, .5);
}
/**
* Basic Layout Theme
*
* This theme uses the default layout class-names for all classes
* Add any 'custom class-names', from options: paneClass, resizerClass, togglerClass
*/
.ui-layout-resizer{ /* all 'resizer-bars' */
background:#DDD;
top:100px
}
.ui-layout-toggler{ /* all 'toggler-buttons' */
background:#AAA;
}
</style><!--[if IE]>
<link rel="stylesheet" type="text/css" href="../common/css/ie.css"/>
<![endif]--><script src="../common/browserDetect.js" type="text/javascript"><!----></script><script src="../common/jquery/jquery-1.7.2.min.js" type="text/javascript"><!----></script><script src="../common/jquery/jquery.ui.all.js" type="text/javascript"><!----></script><script src="../common/jquery/jquery.cookie.js" type="text/javascript"><!----></script><script src="../common/jquery/treeview/jquery.treeview.min.js" type="text/javascript"><!----></script><script src="../common/jquery/layout/jquery.layout.js" type="text/javascript"><!----></script><script src="search/l10n.js" type="text/javascript"><!----></script><script src="search/htmlFileInfoList.js" type="text/javascript"><!----></script><script src="search/nwSearchFnt.js" type="text/javascript"><!----></script><script src="search/stemmers/en_stemmer.js" type="text/javascript" /><script src="search/index-1.js" type="text/javascript"><!----></script><script src="search/index-2.js" type="text/javascript"><!----></script><script src="search/index-3.js" type="text/javascript"><!----></script><meta name="date" content="" /><meta name="dc.date.created" content="" /><link rel="stylesheet" type="text/css" href="../common/css/docbook.css" /><link media="print" rel="stylesheet" type="text/css" href="../common/css/print.css" /><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-41389295-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script></head><body><noscript><link rel="stylesheet" type="text/css" href="../common/css/print.css" /><div id="noscript">JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.</div></noscript><div id="header"><a href="http://www.atmel.com/webdoc"><img id="logo" alt="Atmel Logo" src="../common/images/logo.png" /></a><h1>Atmel EDBG-based Tools Protocols<br />SPI programming protocol commands</h1><div id="navheader"><!----><table class="navLinks"><tr><td><a title="Hide TOC tree" tabindex="5" class="pointLeft" onclick="myLayout.toggle('west')" href="#" id="showHideButton">Sidebar
</a></td><td><a tabindex="5" class="navLinkPrevious" accesskey="p" href="ch07s01s06.html">Prev</a>
|
<a tabindex="5" class="navLinkUp" accesskey="u" href="ch07s01.html">Up</a>
|
<a tabindex="5" class="navLinkNext" accesskey="n" href="ch07s01s08.html">Next</a></td></tr></table></div></div><div id="content"><!----><div class="section"><div xmlns="" class="titlepage"><div><div><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="N1291C" />SPI Program Flash</h3></div></div></div><p xmlns="http://www.w3.org/1999/xhtml">Programs data into flash memory using SPI programming</p><div class="table"><a id="N12921" /><p class="title"><strong>Table&nbsp;151.&nbsp;SPI Program Flash command format</strong></p><div class="table-contents"><table summary="SPI Program Flash command format" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Size</th><th>Description</th></tr></thead><tbody><tr><td>SPI_CMD_PROGRAM_FLASH</td><td>1 byte</td><td>Command ID</td></tr><tr><td>NumBytes</td><td>2 byte</td><td>Total number of bytes to program, MSB first</td></tr><tr><td>mode</td><td>1 byte</td><td>XML: mode*. Mode byte*</td></tr><tr><td>delay</td><td>1 byte</td><td>XML: delay. Delay, used for different types of programming termination, according to mode byte</td></tr><tr><td>cmd1</td><td>1 byte</td><td>Command 1 (Load Page, Write Program Memory)</td></tr><tr><td>cmd2</td><td>1 byte</td><td>Command 2 (Write Program Memory Page) </td></tr><tr><td>cmd3</td><td>1 byte</td><td>Command 3 (Read Program Memory)</td></tr><tr><td>poll1</td><td>1 byte</td><td>Poll Value #1</td></tr><tr><td>poll2</td><td>1 byte</td><td>Poll Value #2 (not used for flash programming)</td></tr><tr><td>Data</td><td>1 byte</td><td>N data</td></tr></tbody></table></div></div><br class="table-break" /><p>*Mode byte: The mode parameter is essential for how this command works. The bits
in the mode byte have the following meanings:</p><div class="table"><a id="N1297E" /><p class="title"><strong>Table&nbsp;152.&nbsp;SPI Flash Programming Mode byte values</strong></p><div class="table-contents"><table summary="SPI Flash Programming Mode byte values" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Bit</th><th>Description</th><th>Mode</th></tr></thead><tbody><tr><td>0</td><td>Word/Page Mode (0 = word, 1 = page)</td><td>&nbsp;</td></tr><tr><td>1</td><td>Timed delay</td><td>Word Mode</td></tr><tr><td>2</td><td>Value polling</td><td>Word Mode</td></tr><tr><td>3</td><td>RDY/BSY polling</td><td>Word Mode</td></tr><tr><td>4</td><td>Timed delay</td><td>Page Mode</td></tr><tr><td>5</td><td>Value polling</td><td>Page Mode</td></tr><tr><td>6</td><td>RDY/BSY polling</td><td>Page Mode</td></tr><tr><td>7</td><td>Write page</td><td>Page Mode</td></tr></tbody></table></div></div><br class="table-break" /><p>The Word/Page Modebit selects if the device supports page programming or not. The
command bytes are different for word and page mode. In word mode, the SPI commands
Write Program Memory and Read Program Memory are used. In page mode, Load Page, Write
Program Memory Page and Read Program Memory are used. The read instruction is used if
Value Polling is specified in the mode bit. The Low/High byte selection bit (3rd bit
in the Load Page, Write Program Memory commands) is handled by EDBG automatically, so leave
this bit cleared. </p><p>
According to the mode, different termination methods are selected &ndash; Timed delay,
Value polling or RDY/BSY polling.</p><p>
For paged operation, the Write pagebit decides if a Write Program Memory Page
command should be issued after the data has been loaded into the page buffer. For
devices with page size bigger than what can be transferred to EDBG in one
command, several SPI_CMD_PROGRAM_FLASH commands must be issued. In
such a case, only the last command should have the Write Page mode bit set. </p><p>
NOTE: Only bit 0-6 are set in the XML file, because bit 7 is not constant and must be controlled
by the PC software. </p><p>
When value polling is used to determine when a programming operation is complete,
poll1 must be supplied. This value indicates which value will be read from the device
until the programmed value is read. This indicates end of programming. poll2 is used
only for EEPROM programming. </p><p>Response:</p><div class="table"><a id="N129D3" /><p class="title"><strong>Table&nbsp;153.&nbsp;SPI Program Flash response</strong></p><div class="table-contents"><table summary="SPI Program Flash response" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Size</th><th>Description</th></tr></thead><tbody><tr><td>SPI_CMD_PROGRAM_FLASH</td><td>1 byte</td><td>Command ID</td></tr><tr><td>Status</td><td>1 byte</td><td><p>SPI_STATUS_CMD_OK or</p><p>SPI_STATUS_CMD_TOUT or</p><p>SPI_STATUS_RDY_BSY_TOUT</p></td></tr></tbody></table></div></div><br class="table-break" /></div><script src="../common/main.js" type="text/javascript"><!----></script><script src="../common/splitterInit.js" type="text/javascript"><!----></script><div class="navfooter"><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch07s01s06.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="ch07s01.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="ch07s01s08.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;</td></tr></table></div></div><div id="sidebar"><div style="padding-top:3px;" id="leftnavigation"><div id="tabs"><ul><li><a tabindex="1" style="outline:0;" href="#treeDiv"><span class="contentsTab">Contents</span></a></li><li><a onclick="doSearch()" tabindex="1" style="outline:0;" href="#searchDiv"><span class="searchTab">Search</span></a></li></ul><div id="treeDiv"><img style="display:block;" id="tocLoading" alt="loading table of contents..." src="../common/images/loading.gif" /><span class="dochome"><a href="../index.html" tabindex="1">Documentation Home</a></span><span class="root"><a href="index.html" tabindex="1">Atmel EDBG-based Tools Protocols</a></span><div style="display:none" id="ulTreeDiv"><ul class="filetree" id="tree"><li><span class="file"><a tabindex="1" href="pr01.html">Preface</a></span></li><li><span class="file"><a tabindex="1" href="protocoldocs.Introduction.html">Introduction</a></span><ul><li><span class="file"><a tabindex="1" href="ch01s01.html">EDBG interface overview</a></span></li><li><span class="file"><a tabindex="1" href="ch01s02.html">Atmel EDBG-based tool implementations</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.cmsis_dap.html">CMSIS-DAP</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s01.html">CMSIS-DAP protocol</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02.html">CMSIS-DAP vendor commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s02s01.html">AVR-target specific vendor commands</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s02.html">ARM-target specific vendor commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s02s02s01.html">Erase pin</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s02s02.html">Serial trace</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch02s02s03.html">EDBG-specific vendor commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s02s03s01.html">Get configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s03s02.html">Set configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s03s03.html">EDBG GET request</a></span></li><li><span class="file"><a tabindex="1" href="ch02s02s03s04.html">EDBG SET request</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="section_serial_trace.html">Serial trace commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch02s03s01.html">Set transport mode</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s02.html">Set capture mode</a></span></li><li><span class="file"><a tabindex="1" href="ch02s03s03.html">Set baud rate</a></span></li><li><span c
Hints and tips
</a></span></li><li><span class="file"><a tabindex="1" href="ch04s05s10.html">Housekeeping ID definitions</a></span></li></ul></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.avr32protocol.html">AVR32 generic protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s01.html">Protocol commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s01s01.html">QUERY</a></span><ul><li><span class="file"><a tabindex="1" href="section_qhb_x1c_sl.html">AVR32 QUERY contexts</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s01s02.html">SET</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s03.html">GET</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr32_setget_params.html">SET/GET parameters</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s01s04.html">Activate Physical</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s05.html">Deactivate Physical</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s06.html">Get ID</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s07.html">Erase</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s08.html">Halt</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s09.html">Reset</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s10.html">Step</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s11.html">Read</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s12.html">Write</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr32_memtypes.html">Memory Types</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s01s13.html">TAP</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s14.html">Is protected</a></span></li><li><span class="file"><a tabindex="1" href="ch05s01s15.html">Erase Section</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s02.html">Responses</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s02s01.html">OK</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s02.html">LIST</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s03.html">ID</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s04.html">PC</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s05.html">DATA</a></span></li><li><span class="file"><a tabindex="1" href="ch05s02s06.html">FAILED</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s03.html">Hints and tips</a></span><ul><li><span class="file"><a tabindex="1" href="ch05s03s01.html">Configuration</a></span></li><li><span class="file"><a tabindex="1" href="ch05s03s02.html">Activate and deactivate physical</a></span></li><li><span class="file"><a tabindex="1" href="ch05s03s03.html">Programming and debugging commands</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch05s04.html">AVR32GENERIC ID definitions</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="protocoldocs.avr8protocol.html">AVR8 generic protocol</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s01.html">Protocol Commands</a></span><ul><li><span class="file"><a tabindex="1" href="ch06s01s01.html">QUERY</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr8_query_contexts.html">AVR8 QUERY contexts</a></span></li></ul></li><li><span class="file"><a tabindex="1" href="ch06s01s02.html">SET</a></span></li><li><span class="file"><a tabindex="1" href="ch06s01s03.html">GET</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html">SET/GET parameters</a></span><ul><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html#N11932">Device context: debugWIRE targets</a></span></li><li><span class="file"><a tabindex="1" href="section_avr8_setget_params.html#N119D3">Device context: megaAVR JTAG targets</a></span></li><li><span class="file"><a tabindex="1" href