I'm using an AM1808 EVM board (with LCD). I have installed the development environment
(version 05.05), I can compile and run applications. The serial port works fine with
the terminal, and I am usinge Ubuntu 12.04.
I would like to add another physical serial port. I mean: not only changing the
port device to /dev/ttyS1, but to actually get 2 physical ports, one for the
terminal I/O and one for my application that will communicate with an external
hardware by serial port.
The current configuration works, therefore the serial port works fine. According
to the hardware schematics, the serial port is linked to UART2. I would like to use
for instance UART0 and UART1, and add a 3232 device converting logical levels to
RS232 levels
1. Is it right to assume that since UART2 works fine, there is no need to reconfigure
and recompile the kernel in order to use UART0 or UART1?
2 The physical port is wired via a level translation device to UART2. According to
the schematics, the easiest way to use another port would be to use UART1 which comes
to the audio extension connector. Are there extension boards for that connector, that
I could use to wire another port? Otherwise, I'll make a conversion PCB.
3. As said earlier, the current serial port is wired to UART2. From the Linux point
of view, is bound to /dev/ttyS0. So I would like to bind UART1 to /dev/ttyS1.
3.1 Where is this defined?
3.2 What do I have to change? (I'm asking this just in case. I guess if I can find
the file that binds UART2 and /dev/ttyS0, then I will probably figure out how
to binde UART1 and /dev/ttyS1. Anyway, any hint is welcome).
4. In order to use a serial port, I am planning to do like this:
file_handle = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
if(file_handle < 0) {
// Error processing
return;
}
// Then use tcgetattr and tcsetattr to set the bit rate and parity, etc...
// Then write:
len = write(file_handle, data, length);
// Finally close:
close(file_handle);
Is this the right way to use a port in this environment?
Thanks,
Pascal