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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

2,946件の閲覧回数
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. 

ラベル(1)
タグ(4)
2 返答(返信)

2,473件の閲覧回数
dellgreen
Contributor I

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

0 件の賞賛
返信

2,473件の閲覧回数
dellgreen
Contributor I

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

Commits · Lauszus/blhost · GitHub 

0 件の賞賛
返信