Forum Discussion
Altera_Forum
Honored Contributor
16 years agoUsing a uart without HAL
Hi, we're just starting out with Nios II. We have a lot of experience with embedded processors, particularly the NXP ARM7 and the Atmel AVR. We are trying to write code to receive the serial li...
Altera_Forum
Honored Contributor
16 years agoHi,
The HAL functions works with UART register, so if in one side you use them to read or write, and on another side you access directly the UART register, this may result in conflict, particularly with interrupts. To access directly the registers of UART, you don't have to disable anything about HAL, just use the macro defined in the file altera_avalon_uart_regs.h. (cf Nios II Software Developer’s Handbook, Chapter 7, part Accessing Hardware, for the use of IORD and IOWR macros). So, to write or read data, you simply have to do the following : IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE, data); data = IORD_ALTERA_AVALON_UART_RXDATA(UART_BASE); Jérôme