2009-01-03 04:45:14     ttyBF0 not reading, writes ok

Document created by Aaronwu Employee on Aug 9, 2013
Version 1Show Document
  • View in full screen mode

2009-01-03 04:45:14     ttyBF0 not reading, writes ok

Brad Bozarth (UNITED STATES)

Message: 67316   

 

I've got my console on ttyBF1 on a custom BF527 board. u-boot and the kernel are both set for this (earlyprintk=serial,uart1,57600 .. console=ttyBF1... etc.). In linux, if I echo a char to ttyBF0, I see it on the uart0 tx pin. I have a micro on the other side spitting characters to the rx (looks the same on the scope as the tx chars coming out of the BF - level/baud wise), but "cat /dev/ttyBF0 | hexdump" gives nothing. I tried stty raw -F /dev/ttyBF0 too, to no avail. I doublechecked baud rate. Any idea what might be wrong? Also strange - the early print says "handoff from earlyBFuart0 -> real ttyBF1", even though I'm clearly seeing the output on uart1. Finally, when I tried disabling only UART0 via the CONFIG_SERIAL_BFIN_UART0 option, it would print nothing else and reboot immediately after said handoff line. (Was trying to disable so I could flip uart0 RX pin as a GPIO to double check pinout).

 

root:/bin> cat /dev/ttyBF0  | hexdump

^Croot:/bin>stty -a -F /dev/ttyBF0

 

speed 115200 baud; rows 24; columns 80;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;

lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff

-iuclc -ixany -imaxbel

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke

 

root:/bin> stty raw -F /dev/ttyBF0

root:/bin> stty -a -F /dev/ttyBF0

 

speed 115200 baud; rows 24; columns 80;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;

lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon

-ixoff -iuclc -ixany -imaxbel

-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

-isig -icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

echoctl echoke

 

root:/bin> cat /dev/ttyBF0  | hexdump

^Croot:/bin>

 

 

 

 

QuoteReplyEditDelete

 

 

2009-01-03 08:01:16     Re: ttyBF0 not reading, writes ok

Robin Getz (UNITED STATES)

Message: 67317   

 

Brad:

 

Maybe the confusion comes from the number schemes.

 

ttyBFn is the logical number (not the physical uart number)

 

earlyprintk;'s earlyBFuartn is the physical uart number (not the logical number),

 

the kernel's logical number has nothing to do with the physical uart number, and can be different. The logical numbers are controlled by the Kconfig (which UARTs are enabled as UARTs).

 

I will have to check to make sure the logic works on a 527 on Monday (since I don't have a 527 board with me now).

 

-Robin

QuoteReplyEditDelete

 

 

2009-01-03 16:53:09     Re: ttyBF0 not reading, writes ok

Brad Bozarth (UNITED STATES)

Message: 67320   

 

Ok, thanks - that explains why it wouldn't boot when I disabled uart0 - needed to change console to ttyBF0 I suppose. But still not sure why I can't read from ttyBF0 (but can see output) when both are enabled!

QuoteReplyEditDelete

 

 

2009-01-03 17:08:02     Re: ttyBF0 not reading, writes ok

Brad Bozarth (UNITED STATES)

Message: 67321   

 

Yes, disabling UART0 and changing bootargs to use ttyBF0 for console let me boot in - and then I was able to verify that both TX and RX pins (gpio23 and gpio24) are hooked correctly to the blackfin by toggling them with /dev/gpioXX. So the mystery of why I can't read incoming data remains

QuoteReplyEditDelete

 

 

2009-01-03 18:18:27     Re: ttyBF0 not reading, writes ok

Brad Bozarth (UNITED STATES)

Message: 67322   

 

I believe I may have solved my problems... Seems "raw" wasn't quite sufficient. I had tried my own little bit of C code that zeroed out the term settings (not sure why that didn't work, blocking reads weren't blocking), but the stty equivalent got my cat/hexdump setup working:

 

stty -F /dev/ttyBF0 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

 

stty -F /dev/ttyBF0 speed 115200 raw cs8

 

cat < /dev/ttyBF0 | hexdump -C

 

 

 

(That's 36 zeroes)

 

Hope this can help someone else.

QuoteReplyEditDelete

 

 

2009-01-04 13:41:11     Re: ttyBF0 not reading, writes ok

Robin Getz (UNITED STATES)

Message: 67335   

 

Brad:

 

Glad things are working for you.

Attachments

    Outcomes