<?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>S12 / MagniV MicrocontrollersのトピックRe: read BKGD signal</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203564#M8250</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to not drive target BDM pin high. You should use on of these options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) use&amp;nbsp;open collector/open drain buffer between host and target MCUs&lt;/P&gt;&lt;P&gt;2) use pin with wired or capability&lt;/P&gt;&lt;P&gt;3)&amp;nbsp;Use software wired or mode. You can latch "0" to port output latch while direction bit is "0". Then you can set or clear direction bit to get driven low or not driven low on output pin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since timing is tight, calculating bus cycles you should take into account when actually write happens, on which 1 out of 4 bset/bclr bus clocks. Bset/bclr reads port in the first bus cycle and writes back to the port on 3rd bus cycle.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 May 2010 17:57:48 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2010-05-27T17:57:48Z</dc:date>
    <item>
      <title>read BKGD signal</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203563#M8249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,Sir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The following function want to read byte from target in BKGD line.&lt;/P&gt;&lt;P&gt;But I find that the signal waveform is wrong from target.Please see it in the attachment.&lt;/P&gt;&lt;P&gt;Please give me support about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void bdmInByte()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; asm{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sei&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldab #8&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldx #0&lt;BR /&gt;&amp;nbsp; Next_In:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bset BKGD_Direction,1&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lslx&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bclr BKGD_Name,1 //pull-down the BKGD pin&amp;nbsp;,4 target clock&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bset BKGD_Name,1 //4 cycle,out1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;,&amp;nbsp;&amp;nbsp;&amp;nbsp;4 target clock&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bclr BKGD_Direction,1//to input ,4 cycles&amp;nbsp;&amp;nbsp;,&amp;nbsp;4 target clock&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldaa BKGD_Name&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; beq In0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; incx&lt;BR /&gt;&amp;nbsp; In0:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; decb&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bne Next_In&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bclr BKGD_Direction,1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tfr x,a&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; staa g_InData;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cli&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 15:57:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203563#M8249</guid>
      <dc:creator>100asong</dc:creator>
      <dc:date>2010-05-27T15:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: read BKGD signal</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203564#M8250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to not drive target BDM pin high. You should use on of these options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) use&amp;nbsp;open collector/open drain buffer between host and target MCUs&lt;/P&gt;&lt;P&gt;2) use pin with wired or capability&lt;/P&gt;&lt;P&gt;3)&amp;nbsp;Use software wired or mode. You can latch "0" to port output latch while direction bit is "0". Then you can set or clear direction bit to get driven low or not driven low on output pin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since timing is tight, calculating bus cycles you should take into account when actually write happens, on which 1 out of 4 bset/bclr bus clocks. Bset/bclr reads port in the first bus cycle and writes back to the port on 3rd bus cycle.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 17:57:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203564#M8250</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-05-27T17:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: read BKGD signal</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203565#M8251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="lia-quilt-column-left lia-quilt-column-20 lia-quilt-column"&gt;&lt;DIV class="lia-quilt-column-alley-left lia-quilt-column-alley"&gt;&lt;DIV class="lia"&gt;&lt;P class="lia-component-post-date-last-edited lia-message-post-date lia-message-dates"&gt;&lt;SPAN class="lia-component-common-widget-date lia-message-posted-on DateTime"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;FONT color="#99CC00"&gt;You have to not drive target BDM pin high. You should use on of these options:&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-component-body lia-message-body"&gt;&lt;DIV class="lia"&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;1) use&amp;nbsp;open collector/open drain buffer between host and target MCUs&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;2) use pin with wired or capability&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;3)&amp;nbsp;Use software wired or mode. You can latch "0" to port output latch while direction bit is "0". Then you can set or clear direction bit to get driven low or not driven low on output pin.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;Since timing is tight, calculating bus cycles you should take into account when actually write happens, on which 1 out of 4 bset/bclr bus clocks. Bset/bclr reads port in the first bus cycle and writes back to the port on 3rd bus cycle.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear Sir.Thans for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know whether my comprehension is right here.&lt;/P&gt;&lt;P&gt;for 1):&lt;/P&gt;&lt;P&gt;&amp;nbsp;host cpu is MC9S12xep100,PB0&amp;nbsp; links BKGD of target MCU(another MC9s12xep100).So I think it is open drain.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have difficulty in 2) and 3).&lt;/P&gt;&lt;P&gt;Could you please give me the detailed code about 3).&lt;/P&gt;&lt;P&gt;Thank a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 18:20:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203565#M8251</guid>
      <dc:creator>100asong</dc:creator>
      <dc:date>2010-05-27T18:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: read BKGD signal</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203566#M8252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, PB0 is push-pull. Open drain can be ports which have corresponding&amp;nbsp;WOMx register.&amp;nbsp;I found 3 WOMx in S12XE datasheet. WOMS, WOMM, WOML. When you set WOMx bit, corresponding pin is configured in open drain (wired OR) mode. For example after setting WOMM0 bit and DDRM0 bits, setting PTM0=0 will drive PTM0 pin low, but setting PTM0=1 will not drive PTM0 pin in any direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Emulating open drain mode for PB0 can be done this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)initially PB0 direction is input&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DDRB &amp;amp;= ~(1&amp;lt;&amp;lt;0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) you latch zero to PB0 output latch&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; PORTB &amp;amp;= ~(1&amp;lt;&amp;lt;0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) with zero latched to PORTB, to drive PB0 low you set DDRB0 bit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; DDRB |= (1&amp;lt;&amp;lt;0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to stop driving PB0 you clear DDRB0 bit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; DDRB &amp;amp;= ~(1&amp;lt;&amp;lt;0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Warning!&amp;nbsp;If XGATE is writing to PORTB, or if interrupts are enabled and some ISR write to PORTB, then special care should be taken, else background task can make PB0 driven high. This will happen&amp;nbsp;if ISR&amp;nbsp;occurs when DDRB0==0. Bsetting or bclearing PORTB with (1&amp;lt;&amp;lt;n) will latch to PB0 value read from PB0, and value read&amp;nbsp;can be "1". For example if some background task uses PB7 pin, then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTA_BIT7 = 0;&amp;nbsp; // wrong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTA_BIT7 = 1;&amp;nbsp; // wrong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTA_BIT7&amp;nbsp;|= (1&amp;lt;&amp;lt;7);&amp;nbsp; // wrong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTA_BIT7&amp;nbsp;&amp;amp;= ~(1&amp;lt;&amp;lt;7);&amp;nbsp; // wrong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Safe way to clear PB7 from background,&amp;nbsp;keeping&amp;nbsp;zero latched in PB0&amp;nbsp;is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; PORTB = (PORTB &amp;amp; ~(1&amp;lt;&amp;lt;7)) &amp;amp; ~(1&amp;lt;&amp;lt;0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,or to set PB7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; PORTB = (PORTB | (1&amp;lt;&amp;lt;7)) &amp;amp; ~(1&amp;lt;&amp;lt;0);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 19:53:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203566#M8252</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-05-27T19:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: read BKGD signal</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203567#M8253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,Dear sir&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; So happy to get your message,Sorry for replying so later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks for your helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 May 2010 12:19:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/read-BKGD-signal/m-p/203567#M8253</guid>
      <dc:creator>100asong</dc:creator>
      <dc:date>2010-05-31T12:19:01Z</dc:date>
    </item>
  </channel>
</rss>

