- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to control the jtag uart in my small footprint nios. But I can't get it working. I mix up the instance or I'm missing header files. in my system.h file the jtag uart is declared as:
#define ALT_MODULE_CLASS_jtag_uart_0 altera_avalon_jtag_uart
#define JTAG_UART_0_BASE 0x44080
#define JTAG_UART_0_IRQ 2
#define JTAG_UART_0_IRQ_INTERRUPT_CONTROLLER_ID 0
#define JTAG_UART_0_NAME "/dev/jtag_uart_0"
#define JTAG_UART_0_READ_DEPTH 64
#define JTAG_UART_0_READ_THRESHOLD 8
#define JTAG_UART_0_SPAN 8
#define JTAG_UART_0_TYPE "altera_avalon_jtag_uart"
#define JTAG_UART_0_WRITE_DEPTH 64
#define JTAG_UART_0_WRITE_THRESHOLD 8
In my c file I try to acces the 32bits control and data register. But that doesn't work. Here is that code
#include <unistd.h>
#include <system.h>
#include "sys/alt_stdio.h"
#include "io.h"
#include "altera_avalon_pio_regs.h"
#include "iic.h"
#include "altera_avalon_jtag_uart.h"
#include "EVI_LVDS_Testchip.h"
int main (void)
{
altera_avalon_jtag_uart_init(JTAG_UART_0,altera_avalon_jtag_uart);
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(0,0);
ALT_DRIVER_READ(JTAG_UART_0_NAME, c, 1, 0);
}
When I compile it I get
EVI_LVDS_Testchip.c: In function `main':
EVI_LVDS_Testchip.c:33: warning: implicit declaration of function `altera_avalon_jtag_uart_init'
EVI_LVDS_Testchip.c:33: error: `JTAG_UART_0' undeclared (first use in this function)
EVI_LVDS_Testchip.c:33: error: (Each undeclared identifier is reported only once
EVI_LVDS_Testchip.c:33: error: for each function it appears in.)
EVI_LVDS_Testchip.c:33: error: `altera_avalon_jtag_uart' undeclared (first use in this function)
EVI_LVDS_Testchip.c:34: warning: implicit declaration of function `IOWR_ALTERA_AVALON_JTAG_UART_CONTROL'
EVI_LVDS_Testchip.c:35: warning: implicit declaration of function `ALT_DRIVER_READ'
make: *** Error 1
Any idea how to access these two registers? Rgds, Kimberley
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume you have a good reason for trying to access the JTAG UART using its registers rather than the HAL interface?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume the HAL interface can not be used on a small footprint nios?
Is that correct? If not, how should I do that? Sorry for being a newbie with this. I managed to get the following working:
#include "altera_avalon_jtag_uart_regs.h"
int i;
char c;
char h;
char s;
c = alt_getchar();
i= IORD(JTAG_UART_0_BASE, ALTERA_AVALON_JTAG_UART_DATA_REG);
alt_printf("\ni=%x", i);
h = i & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK;
alt_printf("\nchar=%x", h);
s = c >> ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST;
alt_printf("\ns=%c", s);
But when the characters are typed in to soon, it misses several. For example: if I type: ABC it can happen that the B is missed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The biggest reason for dropping the characters is that the NIOS simply isn't keeping up with the data as it comes in. If you type the characters slowly, do you get them all? How large did you make the input buffer on the UART?
Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) If the nios is not keeping up with it, should I create an irq routine to get them all?
2) Yes, if I type slowly I see them. According to the system.h file I assume my collegue made it 64 bytes. #define JTAG_UART_0_WRITE_DEPTH 64 3) Coming back on your earlier question, can I use the HAL on a NIOS small footprint? Rgds, Kimberley- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say "NIOS small footprint" I assume you mean you are enabling certain options in your BSP or "System Library" settings such as:
"Reduced Device Drivers" "Small C Library" These do have impact on some of the STDIO functions and on the JTAG UART. Specifically, have a look at the section starting on page 6-30 of the following document: http://www.altera.com/literature/hb/nios2/n2sw_nii5v2.pdf This section details methods for reducing code size. Specifically, if you enable "Reduced Device Drivers", the JTAG uart operates in polled mode rather then IRQ mode. Also, if you use the small C library you don't got stdio input functions (like getc() or getchar()). Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Question: Where can I verify that the system is really a small footprint version? In which file do I have to look for the use of small c library and reduced device drivers?
I understood from collegues that the hired contractor (which is not in anymore) created a small footprint NIOS. This could be seen by the use of alt_printf, ect. Also the use of alt_stdio.h instead off stdio.h. Now I have to continue where the contractor has stopped. Do I then have to look in some system on chip tool? In the FPGA tools? Sorry I'm a software writer, not an FPGA writer.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps what you're referring to the actual hardware implementation of the NIOS. There are three variations of the NIOS (economy, standard, and fast). Perhaps you're indicating that the contractor created the "economy" version of the core. I believe if you look in the "system.h" file inside your BSP or System Library there is a line similar to the following:
#define NIOS2_CPU_IMPLEMENTATION "fast"
This indicates which core was chosen. Consequently, the "economy" core is very slow with regards to it's MIPS performance. With regards to the settings I previously mentioned. They are configured in your BSP or System Library settings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jake,
What I see in the system.h file is this#define NIOS2_CPU_IMPLEMENTATION "tiny"
Where can I see if "Reduced Device Drivers" are used or the "small C library" Can I see this also in the system.h file. Sorry for being such a newbie. Rgds, Kimberley
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I managed to get some of it going by recreating the project.
altera_jtag_uart_read() is now recognized. But the problem I now see is that it does not read anymore after the first read. It displays only the charcter written the first time
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page