<?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: Invalid baud rate set by blhost when updating over UART (Linux host) in MCU Bootloader</title>
    <link>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640955#M263</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did this ever get patched, or is there patches available to fix this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Oct 2019 05:57:40 GMT</pubDate>
    <dc:creator>dellgreen</dc:creator>
    <dc:date>2019-10-23T05:57:40Z</dc:date>
    <item>
      <title>Invalid baud rate set by blhost when updating over UART (Linux host)</title>
      <link>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640954#M262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is actually two-part thing.&lt;/P&gt;&lt;P&gt;1. BLHOST ignores baud rate setting. Here is a snippet from serial.c (KBOOT 2.0)&lt;/P&gt;&lt;P&gt;switch (speed)&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;{&lt;BR /&gt; case 9600:&lt;BR /&gt; speed = B9600;&lt;BR /&gt; break;&lt;BR /&gt; case 38400:&lt;BR /&gt; speed = B38400;&lt;BR /&gt; break;&lt;BR /&gt; case 115200:&lt;BR /&gt; speed = B115200;&lt;BR /&gt; break;&lt;BR /&gt; case 57600:&lt;BR /&gt; default:&lt;BR /&gt; speed = B57600;&lt;BR /&gt; break;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;cfsetospeed(&amp;amp;tty, B57600);&lt;BR /&gt; cfsetispeed(&amp;amp;tty, B57600);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Quite obviously the requested baud rate is being simply ignored in favor of 57600&lt;/P&gt;&lt;P&gt;This was supposed to be&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;cfsetospeed(&amp;amp;tty, speed);&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;cfsetispeed(&amp;amp;tty, speed);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;2. Even worse - the baud rate is then overwritten in&amp;nbsp;serial_set_read_timeout&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt; &lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;memset(&amp;amp;tty, 0x00, sizeof(tty));&lt;BR /&gt; cfmakeraw(&amp;amp;tty);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;set a bunch of flags (but not speed)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt; if (tcsetattr(fd, TCSAFLUSH, &amp;amp;tty) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;For this to work properly it needs to be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt; &lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;tcgetattr(fd, &amp;amp;tty);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;instead of&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;cfmakeraw(&amp;amp;tty);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;Since most testing at Freescale has been obviously done on FRDM boards which use cdc_acm driver, this has not been an issue since cdc_acm driver ignores invalid baud rate (0 is invalid). However CP210x driver (Silicon Labs) assumes 300 bps (FTDI defaults to 9600). This results in time required to flash a small 50KB image being about 1hr.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2016 00:17:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640954#M262</guid>
      <dc:creator>alexfeinman</dc:creator>
      <dc:date>2016-11-09T00:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid baud rate set by blhost when updating over UART (Linux host)</title>
      <link>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640955#M263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did this ever get patched, or is there patches available to fix this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2019 05:57:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640955#M263</guid>
      <dc:creator>dellgreen</dc:creator>
      <dc:date>2019-10-23T05:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid baud rate set by blhost when updating over UART (Linux host)</title>
      <link>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640956#M264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like 3rd party fork and fixes can be found here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/Lauszus/blhost/commits/master" title="https://github.com/Lauszus/blhost/commits/master"&gt;Commits · Lauszus/blhost · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2019 06:07:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCU-Bootloader/Invalid-baud-rate-set-by-blhost-when-updating-over-UART-Linux/m-p/640956#M264</guid>
      <dc:creator>dellgreen</dc:creator>
      <dc:date>2019-10-23T06:07:37Z</dc:date>
    </item>
  </channel>
</rss>

