Forum Discussion
Altera_Forum
Honored Contributor
11 years agoHi Dave
Ive read for the last couple days on this. I wanted to have "something" before i came back and bugged you. For the sake of discussion here, Im an "Altera idiot." Ive managed to get the qsys spi nios working, and can use system console to load memory contents, but the for rest of the Altera universe, i know very little. So, im open to suggestions... Heres what i need: a host side sw-driven way to trigger the nios/spi to send out data to my DUT. My DUT cant init the interrupt. I would imagine that the only "sw-driven interrupt" that i could init from the host to trigger the spi transmission would be some kind of uart transmission. I implemented something in my nios code: char* msg = "Detected the character 't'.\n"; FILE* fp; char prompt = 0; fp = fopen ("/dev/jtag_uart_0", "r+"); //Open file for reading and writing if (fp) { printf("uart has been opened"); while (prompt != 'v') { // Loop until we receive a 'v'. prompt = getc(fp); // Get a character from the JTAG UART. printf("char received %c\n", prompt); if (prompt == 't') { // Print a message if character is 't'. fwrite (msg, strlen (msg), 1, fp); } // if (ferror(fp)) {// Check if an error occurred with the file // pointer clearerr(fp); // If so, clear it. // } fprintf(fp, "Closing the JTAG UART file handle.\n"); fclose (fp); } } and it sat there waiting for a trigger, but when i used the bytestream example in system console set bytestream_index 0 set bytestream [lindex [get_service_paths bytestream] $bytestream_index] set claimed_bytestream [claim_service bytestream $bytestream mylib] # Send FeedbackTo specify the outgoing data as a list of bytes and send it through the opened service: set payload [list 1 2 3 4 5 6 7 8] bytestream_send $claimed_bytestream $payload it failed to claim the service. I got curious and stopped the nios processor, and i could then claim the service and send the data. But of course, my nios wasnt running. Restarted the nios and it froze up. Then i tried just monitoring the uart status byte while (!(uart_status = IORD(JTAG_UART_0_BASE, 2) & 0x40)); but got similar results when trying to use system-console I tried looking at using the nios2-terminal to send data over the uart, but after i enter "nios2-terminal", and hit enter, it just freezes up. Cant enter characters or do anything. Have to kill it with cntrl-c So heres some questions for you: 1)Seeing as how i need the host to generate the interrupt/trigger, is there something better than the uart to accomplish this? Can you show me an example? At this point, id even settle for having nios monitor some led or something and have host set the led... 2)Is there a way for both the system console and the nios to share the uart? 3)Is there a better tool to use on the host side to generate the interrupt (other than system console)? thanks!