<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configuration of the 52840 UART peripheral for 7 bit transmission.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74708/configuration-of-the-52840-uart-peripheral-for-7-bit-transmission</link><description>I am attempting to use the UART peripheral with a UART device which communicates via 1 start, 7 data, 1 even parity and 1 stop bits. 
 Is there any? way to configure or fake the UART peripheral to shift 7 bits of data per transaction? 
 It doesn&amp;#39;t appear</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 May 2021 20:22:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74708/configuration-of-the-52840-uart-peripheral-for-7-bit-transmission" /><item><title>RE: Configuration of the 52840 UART peripheral for 7 bit transmission.</title><link>https://devzone.nordicsemi.com/thread/308015?ContentTypeID=1</link><pubDate>Mon, 03 May 2021 20:22:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa8bb2b4-3961-4617-a1e0-7f9e3d4dc5f9</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;.. test the Rx parity bit first, using the same table:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static const uint8_t EvenParityTable[128] =
    {0x00,     // 00   0000 0000  0
     0x80,     // 01   0000 0001  1
     0x80,     // 02   0000 0010  1
     0x00,     // 03   0000 0011  0
     0x80,     // 04   0000 0100  1
     0x00,     // 05   0000 0101  0
     0x00,     // 06   0000 0110  0
     0x80,     // 07   0000 0111  1
     0x80,     // 08   0000 1000  1
     0x00,     // 09   0000 1001  0
     0x00,     // 0A   0000 1010  0
     0x80,     // 0B   0000 1011  1
     0x00,     // 0C   0000 1100  0
     0x80,     // 0D   0000 1101  1
     0x80,     // 0E   0000 1110  1
     0x00,     // 0F   0000 1111  0
     ... etc
TxChar must lie in range 0x00:0x7F (7-bits)

   // Send bytes
   TxChar |= EvenParityTable[TxChar];
   
   // Receive bytes
   RxChar = RawChar &amp;amp; 0x7F;
   // Check if parity different
   if ((RawChar &amp;amp; 0x80) ^ EvenParityTable[RxChar])
   {
      panic, parity failed
   }&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuration of the 52840 UART peripheral for 7 bit transmission.</title><link>https://devzone.nordicsemi.com/thread/308014?ContentTypeID=1</link><pubDate>Mon, 03 May 2021 20:11:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecc8fb05-e158-452a-ae8c-72f8b62a476b</guid><dc:creator>ccasebeer</dc:creator><description>&lt;p&gt;I can see how this would work on the TX.&lt;/p&gt;
&lt;p&gt;Would it work on the RX?&lt;/p&gt;
&lt;p&gt;I could always just go null out the 8&amp;#39;th bit (the read in parity)....&lt;/p&gt;
&lt;p&gt;I wonder if the RX&amp;#39;ed stop would be messed.&lt;/p&gt;
&lt;p&gt;Edit. Now that I think about it. It would work. I just need to zero out the read in parity bit.&lt;/p&gt;
&lt;p&gt;Greatly! appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuration of the 52840 UART peripheral for 7 bit transmission.</title><link>https://devzone.nordicsemi.com/thread/308010?ContentTypeID=1</link><pubDate>Mon, 03 May 2021 19:25:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc9a5998-b306-4e49-9386-76f217389f21</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You would have to work in 8-bit no parity mode, then spoof the 8th bit as the required even parity for every single byte before transmitting the buffer. That can be done with a 128-byte lookup table which has a mask of the 8th parity bit which would be or&amp;#39;d with the data byte, so very fast.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static const uint8_t EvenParityTable[128] =
    {0x00,     // 00   0000 0000  0
     0x80,     // 01   0000 0001  1
     0x80,     // 02   0000 0010  1
     0x00,     // 03   0000 0011  0
     0x80,     // 04   0000 0100  1
     0x00,     // 05   0000 0101  0
     0x00,     // 06   0000 0110  0
     0x80,     // 07   0000 0111  1
     ...
     
TxChar must lie in range 0x00:0x7F (7-bits)

   TxChar |= EvenParityTable[TxChar];&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>