EmbDev.net

Forum: ARM programming with GCC/GNU tools Serial_Non-conform-Baudrate 1,250,000 Bd


von Peter P. (peter-p)


Rate this post
useful
not useful
Hi,
have anybody an idea? I want set the UART Baudrate to 1.25MB with ioctl. 
But the Flag "ASYNC_SPD_CUST", don't reach the kernel. On the other hand 
the return of the Kernel, reading the "struct serial" don’t reach the 
User space.

I have seen with printk()in  Module serial_core.c, that baud_base in 
struct is set from kernel to 2,500,000Bd. But don’t see it in user space 
in my application. Is there the possibility that "copy_to_user" doesn’t 
work in "static int uart_get_info" in "serial_core.c".

Here are the Application-Code snipped. Perhaps there is something wrong?

fd=open_port();

struct termios newtio;
struct serial_struct new_serdrvinfo;


// Set baudrate to 38400:
cfsetispeed(&newtio, B38400);
cfsetospeed(&newtio, B38400);
tcsetattr(fd, TCSANOW, &newtio );

// Change serial driver settings:
ioctl(fd, TIOCGSERIAL, &new_serdrvinfo);

// custom  Baudrate=9600
// set custom divisor (2,500,000Mhz/9600Bd = 260;
new_serdrvinfo.custom_divisor = 260;
new_serdrvinfo.flags |= ASYNC_SPD_CUST;
ioctl(fd, TIOCSSERIAL, &new_serdrvinfo);
close(fd);

printf("custom_divisor = %d \n", new_serdrvinfo.custom_divisor);
printf("baud_base = %d \n", new_serdrvinfo.baud_base);

I'm running Linux 2.6.23.atmel.4, Avr32AP7000, the Hardware is like 
STK1000.

Know some bode the problem und can help?
Many Thanks

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.