2008-04-15 17:40:58     bf548 - UART2/3

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

2008-04-15 17:40:58     bf548 - UART2/3

Rob D (UNITED STATES)

Message: 54292    Hi All...

 

Has anyone successfully used UART3 on the bf548?  I'm using r6495 of the 2008R1 branch.

 

In the kernel config I have UART 1,2,3 enabled which translates to /dev/ttyBF0,1,2

 

When I do 'echo "hi" > /dev/ttyBF2', the command takes like 30s to return and I don't see any signaling on the UART3 TX pin with the scope.  I have PB.2 and PB.3 to 'off' to disconnect the pins from push buttons.  I have also set SW16.1 to 'off'.

 

Any thoughts?

 

root:/> dmesg | grep uart                                                        

bfin-uart.1: ttyBF0 at MMIO 0xffc02000 (irq = 48) is a BFIN-UART              

bfin-uart.1: ttyBF1 at MMIO 0xffc02100 (irq = 40) is a BFIN-UART              

bfin-uart.1: ttyBF2 at MMIO 0xffc03100 (irq = 42) is a BFIN-UART              

 

root:/> time echo "hi" > /dev/ttyBF2                                          

real    0m 0.02s                                                              

user    0m 0.00s                                                              

sys     0m 0.02s     

 

The interesting ting about the above 'time' command says it returns very quickly, but in practice, it's very very slow.  Something is wrong.

 

Thanks!

QuoteReplyEditDelete

 

 

2008-04-15 17:52:26     Re: bf548 - UART2/3

Mike Frysinger (UNITED STATES)

Message: 54293    ive tested UART3 under u-boot and it worked fine, but i havent tried the kernel before

QuoteReplyEditDelete

 

 

2008-04-15 22:19:03     Re: bf548 - UART2/3

Graf Yang (CHINA)

Message: 54295    There maybe a bug, when request dma channel for UART2/3.

Please try modify bfin_dma_5xx.c:

 

arch/blackfin/kernel/bfin_dma_5xx.c    2008-04-14 12:32:05 UTC (rev 4593)

@@ -108,10 +108,10 @@

     if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) {

         if (strncmp(device_id, "BFIN_UART", 9) == 0)

             dma_ch[channel].regs->peripheral_map |=

-                (channel - CH_UART2_RX + 0xC);

+                ((channel - CH_UART2_RX + 0xC)<<12);

         else

             dma_ch[channel].regs->peripheral_map |=

-                (channel - CH_UART2_RX + 0x6);

+                ((channel - CH_UART2_RX + 0x6)<<12);

     }

 

QuoteReplyEditDelete

 

 

2008-04-16 15:07:34     Re: bf548 - UART2/3

Rob D (UNITED STATES)

Message: 54358    Graf,

 

Great!  UART3 TX now works as expected.  I can't test UART2 RX as I don't have the pins pulled out.

 

There still appears to be something wrong though.

 

echo "hi" > /dev/ttyBF1

 

still takes a looong time to return.  The above code doesn't seem to address UART3_RX or UART2_TX?

 

Thanks for the quick patch!  I'll report back when I test some other stuff.

 

-Rob

QuoteReplyEditDelete

 

 

2008-04-17 15:38:44     Re: bf548 - UART2/3

Mike Frysinger (UNITED STATES)

Message: 54434    define "long time".  did you configure things on the UART ?  what does `stty -F /dev/ttyBF1 -a` show ?

QuoteReplyEditDelete

 

 

2008-04-17 18:09:49     Re: bf548 - UART2/3

Rob D (UNITED STATES)

Message: 54438    Hi Mike,

 

"long time" means ~32 seconds to execute 'time echo "hi" > /dev/ttyBF1' even though the systems thinks it's returning instantly (see below).  It's acting the same way ttyBF2 acted before Graf's DMA fix.

 

Mike, do you have a 548 ezkit to test with?  It should be really easy to do.  Enable uart1,2,3 with DMA and do an 'echo' command.

 

Here is the info you wanted...

 

root:/> stty -F /dev/ttyBF1 -a

speed 9600 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:/> time echo "hi" > /dev/ttyBF1

real    0m 0.02s

user    0m 0.00s

sys     0m 0.02s

 

Any thoughts?

 

Thanks!

 

-Rob

QuoteReplyEditDelete

 

 

2008-04-17 22:17:49     Re: bf548 - UART2/3

Mike Frysinger (UNITED STATES)

Message: 54444    i only tested UART1/UART3 on my BF548 EZKIT.  Sonic can take a look at the UART2.

QuoteReplyEditDelete

 

 

2008-04-18 04:59:51     Re: bf548 - UART2/3

Graf Yang (CHINA)

Message: 54470   

 

Please try below code.

we should not use '|='

 

arch/blackfin/kernel/bfin_dma_5xx.c    2008-04-14 12:32:05 UTC (rev 4593)

@@ -108,10 +108,10 @@

     if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) {

         if (strncmp(device_id, "BFIN_UART", 9) == 0)

             dma_ch[channel].regs->peripheral_map =

                ((channel - CH_UART2_RX + 0xC)<<12);

         else

             dma_ch[channel].regs->peripheral_map =

                ((channel - CH_UART2_RX + 0x6)<<12);

     }

 

QuoteReplyEditDelete

 

 

2008-04-21 15:07:30     Re: bf548 - UART2/3

Rob D (UNITED STATES)

Message: 54640    Hi Graf!

 

That last fix appears to be working!  The 'echo' command no longer takes 30s to return.  I can't really test UART1 because I don't have the pins pulled out, but UART2 works just fine!

 

I hope this changes makes it into mainline!

 

Thanks a lot

 

-Rob

QuoteReplyEditDelete

 

 

2008-04-21 22:09:43     Re: bf548 - UART2/3

Graf Yang (CHINA)

Message: 54660    I will check in this code. If there are any other problems, please let us know.

Attachments

    Outcomes