<?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: SCI Receive Problem w/ RS08KB2 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201497#M16517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, and welcome to the forum.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Paul@STL wrote:&lt;BR /&gt;&lt;P&gt;I traced the signal directly to the microcontroller pin, and it appears to arrive there in good shape. It's a &lt;FONT color="#ff0000"&gt;+10-12V&lt;/FONT&gt; signal, so I clamped it to +5V with a resistor and Schottky diode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This would seem to suggest that you are directly connecting the TxD and RxD pins from the host computer, directly to the MCU pins.&amp;nbsp; Firstly, you risk damaging the MCU with over-voltage, and with possible static discharge.&amp;nbsp;&amp;nbsp;Both MCU pins require additional interface circuitry to provide the necessary protection, and the&amp;nbsp;correct operation of the SCI.&amp;nbsp; Traditionally this is provided by a MAX232 device, or similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A second issue is that the interface devices normally provide polarity inversion for both the&amp;nbsp;transmitter and the receiver.&amp;nbsp; With&amp;nbsp;direct connection, you do not provide this external&amp;nbsp;inversion, as required by the POR default SCI setup.&amp;nbsp; For special circumstances, it is possible to internally&amp;nbsp;invert the polarity of the TxD signal, the RxD signal, or both.&amp;nbsp; The control bits SCIC3_TXINV and SCIS2_RXINV are available for this purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the received data, the incorrect polarity would mean that the start bit of each character would not be properly detected, hence the garbage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2012 09:28:54 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2012-01-30T09:28:54Z</dc:date>
    <item>
      <title>SCI Receive Problem w/ RS08KB2</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201495#M16515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a long time reader but a first time poster here. I'm using an RS08KB2 microcontroller with CodeWarrior v10.1 and I'm having a lot of trouble receiving data through the SCI module. Everything I receive is gibberish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To begin, I've re-mapped the SCI pins in SOPT1 since I'm using an 8 pin device. I also trimmed the ICS (I'm using a P&amp;amp;E Micro USB Multilink). At this point, I'm trying to get &lt;EM&gt;any&lt;/EM&gt; meaningful data from the SCI module so I'm just polling it. Here's how I set the module up (I'm running the chip at the standard 4MHz bus speed):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SCIBD = 0x001A;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 9600 baudSCIC1 = 0x00;SCIC2 = 0x0C;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable RxD and TxD&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Here's what I'm doing to receive the data ('test' is a 64 byte long array):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;for(;;){&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!SCIS1_RDRF);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(SCIS1_OR){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test[i] = SCID;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; test[i] = SCID;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i&amp;gt;64){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&amp;nbsp;&amp;nbsp;&amp;nbsp; }}&lt;/PRE&gt;&lt;P&gt;Pretty straightforward, right? I've sent data through the transmitter and I'm measuring ~0.1ms per bit with my oscilloscope; I believe that corresponds to the correct 9600 baud rate. I've also connected the device I'm trying to read to my computer with a USB-serial adapter, and I can read the data with TeraTerm or HyperTerminal with no problems (8 data bits, no parity, 1 stop bit, no flow control).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SCI module in the RS08 is receiving &lt;EM&gt;something&lt;/EM&gt;, but it's complete nonsense. The data I received through TeraTerm consists of standard ASCII characters, the data I'm receiving through the SCI module is all over the place: nonsensical control characters, large numbers like 0xEB, 0x82, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I figured maybe the BDM was impacting the timing, so at one point, I even had the code send a character on the TxD pin if it received a valid character. I ran the code, removed the BDM, and watched for changes on the oscilloscope: alas, nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what's wrong, but I feel like I've tried everything!&amp;nbsp;Thanks so much for your help!&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;P&gt;-Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 03:52:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201495#M16515</guid>
      <dc:creator>Paul_STL</dc:creator>
      <dc:date>2012-01-30T03:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: SCI Receive Problem w/ RS08KB2</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201496#M16516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's some more information on the matter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I traced the signal directly to the microcontroller pin, and it appears to arrive there in good shape. It's a +10-12V signal, so I clamped it to +5V with a resistor and Schottky diode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are no error flags set in the SCIS1 status register, but I suppose that doesn't necessarily mean there aren't any errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The target doesn't have its own power supply and I was previously powering it with +5V from my bench power supply. I once had a noise issue when powering a microcontroller directly from my bench power supply, so this MCU is now powered by a 9V battery and a linear regulator.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 07:33:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201496#M16516</guid>
      <dc:creator>Paul_STL</dc:creator>
      <dc:date>2012-01-30T07:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: SCI Receive Problem w/ RS08KB2</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201497#M16517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, and welcome to the forum.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Paul@STL wrote:&lt;BR /&gt;&lt;P&gt;I traced the signal directly to the microcontroller pin, and it appears to arrive there in good shape. It's a &lt;FONT color="#ff0000"&gt;+10-12V&lt;/FONT&gt; signal, so I clamped it to +5V with a resistor and Schottky diode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This would seem to suggest that you are directly connecting the TxD and RxD pins from the host computer, directly to the MCU pins.&amp;nbsp; Firstly, you risk damaging the MCU with over-voltage, and with possible static discharge.&amp;nbsp;&amp;nbsp;Both MCU pins require additional interface circuitry to provide the necessary protection, and the&amp;nbsp;correct operation of the SCI.&amp;nbsp; Traditionally this is provided by a MAX232 device, or similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A second issue is that the interface devices normally provide polarity inversion for both the&amp;nbsp;transmitter and the receiver.&amp;nbsp; With&amp;nbsp;direct connection, you do not provide this external&amp;nbsp;inversion, as required by the POR default SCI setup.&amp;nbsp; For special circumstances, it is possible to internally&amp;nbsp;invert the polarity of the TxD signal, the RxD signal, or both.&amp;nbsp; The control bits SCIC3_TXINV and SCIS2_RXINV are available for this purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the received data, the incorrect polarity would mean that the start bit of each character would not be properly detected, hence the garbage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 09:28:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201497#M16517</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2012-01-30T09:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: SCI Receive Problem w/ RS08KB2</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201498#M16518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Mac,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did indeed connect the RxD pin to the host (not a PC) without an interface IC, but the resistor/diode clamped the signal to an acceptable voltage. Nevertheless, the signal polarity was the problem. This is a receive-only application, so I opted for a transistor as a level-shifter/inverter as opposed to a full blown MAX232. I looked for the RXINV bit in the control registers, but it doesn't seem like it exists in RS08 devices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your insight. The signal polarity even crossed my mind once, but I didn't investigate any further...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 10:35:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201498#M16518</guid>
      <dc:creator>Paul_STL</dc:creator>
      <dc:date>2012-01-30T10:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: SCI Receive Problem w/ RS08KB2</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201499#M16519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Slight correction: I see the RXINV bit in the SCIS2 register now... my mistake. Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 14:56:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SCI-Receive-Problem-w-RS08KB2/m-p/201499#M16519</guid>
      <dc:creator>Paul_STL</dc:creator>
      <dc:date>2012-01-30T14:56:29Z</dc:date>
    </item>
  </channel>
</rss>

