2010-04-05 14:20:46     bf537 UART0 control

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

2010-04-05 14:20:46     bf537 UART0 control

Steven Vacca (UNITED STATES)

Message: 88100   


I need to use the bf537 UART0 to send a half-duplex serial (RS485) msg to a device, and I need to know exactly when the last byte of the msg was sent so that I can change the RS485 direction from TX to RX in order to get the response msg from the device.


This would require UART0 TX interrupts. Are there any examples of setting-up the serial baud rate, etc., and writing/reading UART0 in this fashion?  Is the relevant file drivers/serial/bfin_5xx.c?  Is opening the driver /devttyBF and executing write() and read() the best way to send these msgs while utilizing the TX interrupts?


Also, the printk()'s are sent out UART0. What is the best way to temporarily disable/flush printk() msgs? Is it acceptable/safe to place a an enable/disable var at the beginning of printk().c to enable/disable printk()'s?






2010-04-05 15:40:41     Re: bf537 UART0 control


Message: 88102   




Are you trying to do things inside the kernel? or inside a user application?


We already have a RS-485 on SPORT .


Have a look at:




All that should be done is to enable the CONFIG_SPORT_TFS.






Although - looking at the driver - I don't see the code checked in. I will check when the developer is back from vacation.






2010-04-05 16:37:50     Re: bf537 UART0 control

Steven Vacca (UNITED STATES)

Message: 88103   


There is an RS485 chip connected to UART0. So, it's all UART0 serial which is converted to RS485 by hardware, in both directions.  Reading thru the bf537 manual, it looks very easy and straightforward to just write my own driver to setup the UART0 regs and TX and RX ISRs.  But, I'm curious about the uClinux approach, using the already supplied bfin_5xx.c funcs.  I'm also trying to figure out the best way to make UART0 comm coexist peacefully with printk()'s.




2010-04-05 18:23:58     Re: bf537 UART0 control

Mike Frysinger (UNITED STATES)

Message: 88106   


dont declare the UART as a console and there wont be a problem.  printks are only routed to consoles.




2010-04-05 23:57:55     Re: bf537 UART0 control

Sonic Zhang (CHINA)

Message: 88112   


You can use the bfin_5xx.c driver directly if you connect the hardware rs485 chip to bf537 uart0.


In order to know exactly when the last byte of the message is out, you should call ioctl with command TIOCSERGETLSR to check if the tx fifo is empty between write() and read() in your application.




2010-04-06 08:29:52     Re: bf537 UART0 control

Steven Vacca (UNITED STATES)

Message: 88145   


I would prefer to have the kernel execute printk()'s to the console during boot-up, but once the app starts executing, I'd like to disable all kernel printk()'s.  Is this doable, and if so, is there a preferred way?




2010-04-06 10:54:33     Re: bf537 UART0 control

Mike Frysinger (UNITED STATES)

Message: 88151   


please read the documentation: