Forums » Software Development »
Trouble with writing to UART2
Added by Jeremy Young almost 12 years ago
I am having some difficulty with writing to the UART2 on the AM1810. I have everything setup such that I can read from the port with out any problems. When I run the command cat /proc/tty/driver/serial I am able to see the Tx count increase when I send data to the UART. Also I am using the UART to 485 board supplied by critical link. The data does not seem to be getting through the 485 board. Any suggestions on trying track down the issue here?
Replies (6)
RE: Trouble with writing to UART2 - Added by Tim Iskander almost 12 years ago
Jeremy
The RS485 board has an enable that must be managed. I believe you need a newer version of the driver to control it.
Support for the RS-485 board was added in commit 3e1a3878bbe545b7d4a2ab65023a9938b0d5984e
dated 2012-12-11
see http://support.criticallink.com/gitweb/?p=linux-mityarm-335x.git;a=summary
cheers
/Tim
RE: Trouble with writing to UART2 - Added by Michael Williamson almost 12 years ago
Hi Jeremy / Tim,
The link Tim pointed you to is for the MityARM-335x, not the MityARM-180x, though a similar patch exists for that as well for the RS-485 drivers.
Sorry for the confusion.
The patch you need is here for the 3.2 kernel. It's also available on the tip of the 2.6.34 kernel (master) branch.
There is wiki about using the patch and IOCTLs described on our MityARM-335x wiki page here but similar logic applies for the OMAP-L138/AM1810 logic.
-Mike
RE: Trouble with writing to UART2 - Added by Jeremy Young almost 12 years ago
I am using the 2.6.34 kernel and it appears it already has the patch applied. I was able to get it to work by reassigning the pins and manually applying the RTS line. With the original configuration, am I supposed to toggle the GPO pin manually or is this done by the serial driver when data is to be sent?
jeremy
RE: Trouble with writing to UART2 - Added by Jeremy Young almost 12 years ago
Additionally, it appears the pin muxing was set up such that the GP09 was not selected due to AMUTE being selected by the mcasp initialization. If i disable the mcasp initialization in the kernel build GP09 is mapped to the rs485 enable. however, I cannot find where the pin assignment is done so that the serial driver knows to toggle this pin when transmitting.
Thanks for the help
Jeremy
RE: Trouble with writing to UART2 - Added by Michael Williamson almost 12 years ago
You need to use the TIOCRS485 ioctl on the serial port file descriptor with the serial_rs485 structure.
It involves writing a bit of code. You can't do it with any shell tools that I am aware of.
See the example code in the rs485_test.tar tarball in the wiki page I had mentioned before, it has examples to configure the GPIO pin and tell the serial UART driver to drive the GPIO while transmitting.
-Mike
RE: Trouble with writing to UART2 - Added by Jeremy Young almost 12 years ago
Thank You for your help, Ultimately I need to use this on the PRU and I saw how TI is doing it through there Profibus utilities module. They set up the pin mux to have PRU0 R3016 toggle the enable line. This seems to be the most efficient way for doing this from the PRU.
Jeremy