Invalid baud rate set by blhost when updating over UART (Linux host)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invalid baud rate set by blhost when updating over UART (Linux host)

1,345 Views
alexfeinman
Contributor III

This is actually two-part thing.

1. BLHOST ignores baud rate setting. Here is a snippet from serial.c (KBOOT 2.0)

switch (speed)

{
case 9600:
speed = B9600;
break;
case 38400:
speed = B38400;
break;
case 115200:
speed = B115200;
break;
case 57600:
default:
speed = B57600;
break;
}

cfsetospeed(&tty, B57600);
cfsetispeed(&tty, B57600);

Quite obviously the requested baud rate is being simply ignored in favor of 57600

This was supposed to be 

cfsetospeed(&tty, speed);
cfsetispeed(&tty, speed);

 

2. Even worse - the baud rate is then overwritten in serial_set_read_timeout

 

memset(&tty, 0x00, sizeof(tty));
cfmakeraw(&tty);

set a bunch of flags (but not speed)

if (tcsetattr(fd, TCSAFLUSH, &tty) < 0)
{
return -1;
}

For this to work properly it needs to be:

 

tcgetattr(fd, &tty);

instead of 

cfmakeraw(&tty);

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. 

Labels (1)
Tags (4)
2 Replies

872 Views
dellgreen
Contributor I

Did this ever get patched, or is there patches available to fix this?

0 Kudos

872 Views
dellgreen
Contributor I

Looks like 3rd party fork and fixes can be found here:

Commits · Lauszus/blhost · GitHub 

0 Kudos