Forum Discussion
Altera_Forum
Honored Contributor
20 years agorubbish out of uart in multiprocessor design
I've got a design with two nios2 cpus which have a uart component and the jtag uart on cpu1. At present I'm just sending some data from cpu2 to cpu1 via shared memory and a mutex. When cpu1 g...
Altera_Forum
Honored Contributor
20 years agoI used this to set the baud rate
# define M_Set_UART_Baudrate(X) IOWR_ALTERA_AVALON_UART_DIVISOR(m_ui_UARTBaseAdress, X)# define M_Get_UART_Baudrate() IORD_ALTERA_AVALON_UART_DIVISOR(m_ui_UARTBaseAdress) //////////////////////////////////////////////////////////////////////////////// bool UARTClass::SetBaudRate // true - success; false - failure ( unsigned int para_ui_Baudrate ) { alt_u16 proc_u16_Baudrate = (alt_u16)((ALT_CPU_FREQ / para_ui_Baudrate) + 0.5); M_Set_UART_Baudrate(proc_u16_Baudrate); if(proc_u16_Baudrate == M_Get_UART_Baudrate()) { return true; } else { return false; } } //////////////////////////////////////////////////////////////////////////////// unsigned int UARTClass::GetBaudRate ( void ) { return IORD_ALTERA_AVALON_UART_DIVISOR(m_ui_UARTBaseAdress); }