- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm starting to learn some verilog coding and nios II. I'm using the book "Embedded SoPC Design with Nios II Processor and Verilog Examples" and in one example the JTAG UART is accessed directly without the HAL. The write function was provided in the example and it works fine. But I set out to make a read function. However unsuccessful. I know that the transmission of data from the PC works if I use the routines provided by the HAL but my implementation does not work. I do this to read from the JTAG UART: // Read from the JTAG UART address alt_32 wrd = IORD(JTAG_UART_BASE,0); // Check if the data is valid if (wrd & 0x00008000) // If so, get the 8 bits that correspond to the character wrd = (wrd & 0x000000ff); else wrd = -1; When I debug the code the value of wrd is always the same no matter what I send from my PC. I suspect that maybe the HAL gets an interrupt whenever a character i received and clear this register. Is that what happens? If so, is there any way to turn off this functionality? Kind regards, AndersLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, did you write your code in an interrupt or in the main program ?
You employ a function when you initialize a local variable : alt_32 wrd = iord(jtag_uart_base,0);. You should first initialize the variable : alt_32 wrd = 0; then read a char from UART and store it to the wrd variable : wrd= IORD...; There are MACROs to read a character or send a character from/to UART : char crd; crd = IORD_ALTERA_AVALON_UART_RXDATA(JTAG_UART_BASE); // for example
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page