Hi,
I am trying to use the UART1 port to communicate with a camera. I am using the RR SDK.
I really don't know where to start when it comes to coding. I've checked out all the code I can on how the UART is configured:
kernel/linux-2.6.29/arch/arm/mach-davinci/board-dm355-leopard.ckernel/linux-2.6.29/arch/arm/mach-davinci/serial.ckernel/linux-2.6.29/arch/arm/mach-davinci/include/mach/serial.h
I tried linking to the serial.h header file above, but my code won't compile because it can't find the file when I try to include it with the line:
#include <mach/serial.h>
As of now, I'm just trying to get something that can transmit data across this protocol using the uart drivers that the RR SDK claims to support. The code (that doesn't compile) is as follows. It should just write a bunch of 1's and 0's to the ttyS1 device.
*****************************************
#include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <sys/ioctl.h> #include <linux/serial.h>#include <mach/serial.h>
#define UART1_DEV "/dev/ttyS1" static struct davinci_uart_config uart_config = { .enabled_uarts = (1 << 1), /* I think this enables UART1 */ } int main(int argc, char *argv[]) { int out_value = 1; int uart1_fd; /* UART1 file descriptor */ /* initialize the serial port */ davinci_serial_init(&uart_config); uart1_fd = open(UART1_DEV, O_RDWR); if (uart1_fd == -1) { /* error opening serial port */ perror("open"); return 1; } if ( ioctl(uart1_fd, DAVINCI_UART1_BASE, uHwAddress) < 0) { /* error assigning uart1_fd to the UART1 hardware * address */ perror("ioctl"); return -1; } while (1) { if ( -1 == write(uart1_fd, out_value, 2) ) { perror("write"); return 1; } sleep(1); out_value ^= 1; /* toggle the out value */ /*if ( -1 == write(uart1_fd, "hello", 6) ) { perror("write"); return 1; }*/ } return 0; }
************************
Any help would be great! Some examples would even be greater!
Thanks,
Billy
Have you had any luck getting uart 1 to work? I would like to do something similar.