<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: YA SPI Question, follow-up in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126380#M1050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Rob, you are short one SPI transfer. You need to discard one more byte. Since the byte that you fetch as the first data byte was received during the transmission of the last address byte, it is not valid. Try this:&lt;OL&gt;&lt;LI&gt;Send 03h&lt;/LI&gt;&lt;LI&gt;read a byte and discard&lt;/LI&gt;&lt;LI&gt;send upper byte of address&lt;/LI&gt;&lt;LI&gt;read a byte and discard&lt;/LI&gt;&lt;LI&gt;send lower byte of address&lt;/LI&gt;&lt;LI&gt;&lt;B&gt;read a byte and discard&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;&lt;B&gt;send a null byte&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;read the first data byte&lt;/LI&gt;&lt;LI&gt;send a null byte&lt;/LI&gt;&lt;LI&gt;read the second data byte (the address auto-increments)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;Let us know how it goes . . .&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Feb 2006 05:18:12 GMT</pubDate>
    <dc:creator>rocco</dc:creator>
    <dc:date>2006-02-17T05:18:12Z</dc:date>
    <item>
      <title>YA SPI Question, follow-up</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126375#M1045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 3;"&gt;First, thanks to Mac and Peg for their eariler comments and suggestions which seem to be leading me in the right direction. Well, until this roadblock.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;void main(void) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;EnableInterrupts;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIC1_MSTR = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// MCU set as SPI master&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIC1_CPHA = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// clock phase default&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIC1_SSOE = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// slave select output enable&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIC2_MODFEN = 1;&amp;nbsp;&amp;nbsp;// ss pin acts as slave select&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIC2_SPC0 = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// uses seperate pins for I/O&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIC1_SPE = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable SPI&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPIBR = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Set baud rate to max (no divisors)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;for(;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;&amp;nbsp;__RESET_WATCHDOG(); // feeds the dog&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;// yes, it's a very short for loop&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// end of main()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;interrupt 18 void KBI_ISR(void)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;{ KBISC_KBACK = 1;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;if (SW1 == 0){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;while (!SPIS_SPTEF);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPID = 0x05;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;while (!SPIS_SPRF);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;my_status = (SPID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;else if (SW2 == 0){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;while (!SPIS_SPTEF);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPID = 0x03;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;while (!SPIS_SPTEF);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPID = 0x00;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;while (!SPIS_SPRF);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;my_serial = (my_serial | SPID) &amp;lt;&amp;lt; 4;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;while (!SPIS_SPRF);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;my_serial = (my_serial | SPID);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 3;"&gt;So, everything seems to be good and I can check the various flags in the debugger, but writing to SPID (&lt;SPAN style="font-family: 'Courier New'; font-size: 2;"&gt;SPID = 0x05;&lt;SPAN style="font-family: Arial; font-size: 3;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt; doesn't do anything and the value of SPID doesn't change. I haven't put a scope on the lines yet, so I don't know if SS is rising and falling as it should, but I'd at least figure that I'd see SPID change. Am I missing something here? That's a silly question.. of course I'm missing something, but what?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 3;"&gt;TIA&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 3;"&gt;Rob&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2006 00:37:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126375#M1045</guid>
      <dc:creator>farwestav</dc:creator>
      <dc:date>2006-02-16T00:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: YA SPI Question, follow-up</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126376#M1046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Register SPID is actually two registers at the same address.&lt;/P&gt;&lt;P&gt;A read gives you the recieved data register&lt;/P&gt;&lt;P&gt;And a write writes to the transmit buffer and then sends it out.&lt;/P&gt;&lt;P&gt;When something is sent something is sent, something is received at exactly the same time. In fact if you just want to recieve you *MUST* send something!!!&lt;/P&gt;&lt;P&gt;In your code for SW1&lt;/P&gt;&lt;P&gt;you do this:&lt;/P&gt;&lt;P&gt;1. wait for txbuf MT&lt;/P&gt;&lt;P&gt;2. send 05&lt;/P&gt;&lt;P&gt;3. wait till its gone and the recieve register is full (same thing)&lt;/P&gt;&lt;P&gt;4. read the SPID **RECEIVE** buffer and load to my_status &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;my_status will hold some undefined value as you have not told us what is connected to MISO.&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For SW2&lt;/P&gt;&lt;P&gt;1. send 03 and ignore what came in&lt;/P&gt;&lt;P&gt;2. send 00 and get recieved byte and do something with it &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;3. now you hang and trip the COP because the reciever will never get full again unless you send something!!! &lt;IMG alt=":smileymad:" class="emoticon emoticon-smileymad" id="smileymad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-mad.gif" title="Smiley Mad" /&gt;&lt;/P&gt;&lt;P&gt;P.S. Not sure what your trying to do with your processing of my_status??? &lt;IMG alt=":smileyindifferent:" class="emoticon emoticon-smileyindifferent" id="smileyindifferent" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-indifferent.gif" title="Smiley Indifferent" /&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2006 17:07:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126376#M1046</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-02-16T17:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: YA SPI Question, follow-up</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126377#M1047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Peg-&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for the quick response.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You said I have to send to receive and that makes sense, but implementing it is confusing. Reading the spec sheet for the EEPROM I'm talking to, it says that the read sequence can be continued as the address is automatically incremented and the data continues to be shifted out.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As to what's happening in these two routines. For SW1, I want to send the op code 05h and then receive back the chip status register&amp;nbsp;byte. MISO from the chip is connected to SO on the EEPROM&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For SW2, I'm trying to read from two address locations and contantinate the two bytes. I need to send the Read op code, 03h, then send the address 00h. I should expect to receive one byte. Now, if I really should expect to send a byte to get a byte, what do I send to get the second byte, 03h (the op code)&amp;nbsp;followed by 01h (the second address location) ? That kinda makes sense, but then I'm stuck on what happens when I send the 03h byte. Does something come back which I just ignore, or will nothing come back?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;TIA,&lt;/DIV&gt;&lt;DIV&gt;Rob&lt;/DIV&gt;&lt;P&gt;Message Edited by farwestav on &lt;SPAN class="date_text"&gt;02-16-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;08:57 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2006 00:28:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126377#M1047</guid>
      <dc:creator>farwestav</dc:creator>
      <dc:date>2006-02-17T00:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: YA SPI Question, follow-up</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126378#M1048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Rob,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;What EEPROM device are you using?&amp;nbsp; I have previously done some progamming for the 25C640 device - it looks like you may be using something similar.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;So the first command you send is probably&amp;nbsp;RDSR (read status register) = 0x05.&amp;nbsp; The first returned byte must be discarded because the command has not yet been processed by the EEPROM.&amp;nbsp;&amp;nbsp;The next byte sent would be a null,&amp;nbsp;so that&amp;nbsp;the return should then be the correct status&amp;nbsp;byte.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The next command you send appears to be a READ = 0x03.&amp;nbsp; What you are then&amp;nbsp;trying to do&amp;nbsp;is a little unclear to me.&amp;nbsp; For the 25C640, the next bytes to be sent would be the high byte of the first address, followed by the low byte of the address.&amp;nbsp; A series of null bytes would then be sent to read one or more of the&amp;nbsp;stored values.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I personally think that the code is much easier to understand when the SPI transaction is handled as a function, as previously suggested (Freegeeks post).&amp;nbsp; I would also define a label for each of the command bytes so the meaning of each command byte is clearer.&amp;nbsp; For example, reading the status register might look like the following:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="3"&gt;SPI_proc(RDSR);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="3"&gt;my_status = SPI_proc(0);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;You do not say how you are programming the EEPROM in the first instance.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Another potential issue could exist if SW1 and SW2 are mechanical switches - you would need to provide debounce so the keyboard ISR does not run multiple times for a single keypress.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2006 02:13:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126378#M1048</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-02-17T02:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: YA SPI Question, follow-up</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126379#M1049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Mac-&lt;/P&gt;&lt;P&gt;Yes, I'm using the AT25640 EEPROM.&lt;/P&gt;&lt;P&gt;I agree that doing this in a function will be easier, and once I prove out the protocol, I'll roll my code into a function or two.&lt;/P&gt;&lt;P&gt;Your idea of sending a byte, ignoring the returned byte, then sending a nulll byte to get the real data byte isn't one I've seen discussed before. I'll add that to my code and see what happens. As to the Read command, I'm going to do this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Send 03h&lt;/LI&gt;&lt;LI&gt;read a byte and discard&lt;/LI&gt;&lt;LI&gt;send upper byte of address&lt;/LI&gt;&lt;LI&gt;read a byte and discard&lt;/LI&gt;&lt;LI&gt;send lower byte of address&lt;/LI&gt;&lt;LI&gt;read the first data byte&lt;/LI&gt;&lt;LI&gt;send a null byte&lt;/LI&gt;&lt;LI&gt;read the second data byte (the address auto-increments)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;When it comes to writing, I'm going to write a similar routine; the code here is just v1.0 and will get additions when I think I know what I'm doing.&lt;/P&gt;&lt;P&gt;Yes, I'm using the mechanical switches on the dev board to trigger the KBI. I think, though, that I'm trapping the KBI well enough that it will only trigger once with each press, regardless of bounce.&lt;/P&gt;&lt;P&gt;Thanks for any other comments,&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2006 02:56:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126379#M1049</guid>
      <dc:creator>farwestav</dc:creator>
      <dc:date>2006-02-17T02:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: YA SPI Question, follow-up</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126380#M1050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Rob, you are short one SPI transfer. You need to discard one more byte. Since the byte that you fetch as the first data byte was received during the transmission of the last address byte, it is not valid. Try this:&lt;OL&gt;&lt;LI&gt;Send 03h&lt;/LI&gt;&lt;LI&gt;read a byte and discard&lt;/LI&gt;&lt;LI&gt;send upper byte of address&lt;/LI&gt;&lt;LI&gt;read a byte and discard&lt;/LI&gt;&lt;LI&gt;send lower byte of address&lt;/LI&gt;&lt;LI&gt;&lt;B&gt;read a byte and discard&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;&lt;B&gt;send a null byte&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;read the first data byte&lt;/LI&gt;&lt;LI&gt;send a null byte&lt;/LI&gt;&lt;LI&gt;read the second data byte (the address auto-increments)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;Let us know how it goes . . .&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2006 05:18:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/YA-SPI-Question-follow-up/m-p/126380#M1050</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-02-17T05:18:12Z</dc:date>
    </item>
  </channel>
</rss>

