Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Problem with interruption on JTAG UART

Dear all,

I have a problem with the JTAG UART and interruption. My aim is to use the JTAG UART to send and receive information from a PC. I want to activate the read interruption but not the write one, i.e. I want an interruption when I receive something, but I want to write just when I want (because it is not regular).

My problem is that the write interruption is always activated. In my program, I just send a message to the PC, and the program goes to the ISR. I do not understand why since I activate only the bit RE in the control register. In the ISR, I read the control register, and it gives me the value 0x00402603. Which means there are 64 spaces available in the write FIFO, the interruption was activate by writing, and the interruption are enable on writing and reading.

If you can tell me why I have this problem. And in the Quartus Handbook volume 5, it is said "Programmers using the HAL API never access the JTAG UART core directly via its registers." But in this case how can we choose which interrupt we want to use ?

Many thanks

Jérôme

FILE * lcd;
void handleJTAGInterrupt (void* context, alt_u32 id)
{
    unsigned int controlRegister;
    
    controlRegister = IORD_ALTERA_AVALON_JTAG_UART_CONTROL(JTAG_UART_BASE);
    fprintf(lcd, "\r%8X", controlRegister);
}
int main (void)
{
    IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(JTAG_UART_BASE, 0x01);                 // Active the read interrupt on JTAG
    alt_irq_register(JTAG_UART_IRQ, 0, handleJTAGInterrupt);                    // Register the ISR for JTAG
    IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0xEE);
    lcd = fopen("/dev/lcd", "w");                                               // Open the LCD device
    printf("test\n");                                                           // Display text on computer (Nios II IDE console)
    while(1);
}

No RepliesBe the first to reply