--- Quote Start ---
For being able of modifying the UART baudrate, check theese:
- In SOPCBuilder open the editor dialog for the UART component in your system (double click on it), there is a parametter for including an UART bauderate register;
- Make sure that you're not using the reduced footprint driver's HAL mode in your system library;
- Include this define ALTERA_AVALON_UART_USE_IOCTL in the compiler preprocessor configuration settings for your system library and recompile it;
- Add the includes# include <sys/ioctl.h> and# include <sys/termios.h> to your source file;
Now you can use code like this for changing the uart speed:
struct termios termios;
int res = ioctl( uartfd, TIOCMGET, &termios );
termios.c_ispeed = your_new_bauderate;
termios.c_ospeed = your_new_bauderate;
res = ioctl( uartfd, TIOCMSET, &termios );
The above code can be used provided that you opened the uart using code like:
int uartfd;
uartfd = open( your_uart_device_name, O_RDWR | O_NONBLOCK | O_NOCTTY );
if (uartfd == -1)
{
printf( "FATAL ERROR with uart \"%s\"\r\n", uart_name );
return 1;
}
The options are ORed according to my needs, which could be a little bit different from yours.
--- Quote End ---
Hi,
Regarding the sentence : Include this define ALTERA_AVALON_UART_USE_IOCTL in the compiler preprocessor configuration settings for your system library and recompile it;
Can you please explain how its done?
Thanks