- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I started with the Cylcone 2 development a few months back. If I send a string of 800 characters some of them are not received at the host even at 9600. I tried three different UARTs. Tha avalon version and 2 from open cores same issue. The project was put on hold and we got Cyclone 3 development board. I am having the same issue with the open cores version we decided to use. Now if I add some rather long delays it works. Anyone see anything wrong?
Thanks in advance void SendChar(char TheChar) { int i;# ifdef AVALON_UART i = IORD_ALTERA_AVALON_UART_STATUS (UART_A_BASE); while ((i & 0x40) == 0) { i = IORD_ALTERA_AVALON_UART_STATUS (UART_A_BASE); } IOWR_ALTERA_AVALON_UART_TXDATA (UART_A_BASE, TheChar);# else while ((IORD_8DIRECT(UART_A_BASE, UARTxLSR) & 0x40) == 0) { } IOWR_8DIRECT(UART_A_BASE, UARTxTHR, TheChar);# endif } int main(void) { int delay_count = 0;# ifdef USE_DELAY while(delay_count < 0x000500000) { delay_count++; } delay_count = 0; while(delay_count < 0x000500000) { delay_count++; }# endif# ifdef AVALON_UART# else // set line control reg to allow writing to baud divisor IOWR_8DIRECT (UART_A_BASE, 3, 0x80); // baud divisor = (clk) div (baud) div (16) // 50M/115200/16 = 27.127 = 0x001B // 30M/115200/16 = 16.276 = 0x0010 // 30M/9300/16 = 195 IOWR_8DIRECT (UART_A_BASE, 1, 0x00); // baud div hi IOWR_8DIRECT (UART_A_BASE, 0, 16); // baud div lo // set line control reg for 8 n IOWR_8DIRECT (UART_A_BASE, 3, 0x03);# endif // sent some lines as fast as you can SendChar(10); SendChar(13); SendChar(10); SendChar(13); SendChar(10); SendChar(13); for (int j = 0; j < 10; j++) { SendChar(0x30 + j); SendChar(' '); for (int i = 0; i < 26; i++) { SendChar(65 + i); SendChar(65 + i); SendChar(65 + i); } }# ifdef USE_DELAY delay_count = 0; while(delay_count < 0x000500000) { delay_count++; }# endif SendChar(10); SendChar(13); for (int j = 0; j < 10; j++) {# ifdef USE_DELAY delay_count = 0; while(delay_count < 0x00050000) { delay_count++; }# endif SendChar(0x30 + j); SendChar(' '); for (int i = 0; i < 26; i++) { SendChar(65 + i); SendChar(65 + i); SendChar(65 + i); } } // end while(1) loop while(1) { } return(0); } Typical output with delay. I had to replace the space with a . to try and keep formatting as displaed on 80 character terminal 0.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 1.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 2.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 3.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 4.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 7.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 8.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 9.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 0.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 1.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ 2.AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ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WWWXXXYYYZZZ3.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ4.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ5.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ6.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ7.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ8.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ9.AAABBBCCCDDDEEEFFFGGG HHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some suggestions:
1. Try looping back the data to the Nios to eliminate the host being an issue. 2. Try using the altera hal uart implementation. I've had no problems with it. 3. Try measuring the baud rate with a scope. 4. Examine the rs-232 signals for handshaking. HW or SW handshaking? Good luck.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is worth checking that the generated code is correctly checking the tx status - but I think an error there wouldn't give the output you are seeing.
I've not used any of the uarts, but I'd suspect you should loop a lot of times once any tx fifo fills. What are you using to display the data? Recent versions of 'putty' are much better than hyperterm.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dduxstadieee
1) I have not tried a loopback. But with one of the open cores version each character written to the transmit register was copied to a buffer. All characters showed up in the buffer. I may investicate this. Thanks for the idea. 2) I tried the hal uart with a cyclone 2. 3) It loosing about 500 characters. It does not matter if the baud is 9600, 57600, or 115200 they all lost a large group. 4) No handshaking. Each character waits for the shift register to be empty and is then written. Then one character is written. FIFOs are enabled, but theoretically the FIFO will never be touched. dsl, How would you go about looking at the tx status. I am assuming something other than examining that status register. I am new to the Cyclone family so a little more detail would be real nice. See not 4 above, but the FIFO should never fill. I am using Tera Term, I have never seen a problem, but that does not mean there isn't one. Thanks all- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well good news and bad - isn't that the way it always is. I had two tools available to me. The first is BusHound this is a great and reasonably priced tool that will let you see what is happening on SCSI, RS232, USB and some other buses.
Well the RS232 was one of the USB dongle. The Bushound capture showed a whole lot of data followed by a 0 (null) and then my missing data. Ahha the NIOS is to blame. My second tool is a Serial analyzer. Guess what it shows no lost characters. So it appears that either the dongle or the driver is to blame. I am off to find a real serial port and see what I get.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found a computer with a UART on the mother board ran it 10 times no problem. With the RS232 USB dongle I would have a failure in three tries.
So anyone know the limitation of the USB dongles? How many characters can they hold? I think mine may have a problem at 384. The bushound trace showed 384 characters every time (I think). Odd number I know - off to research.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps 'Tera Term' is just being confused by a '\0' byte in a buffer full of data received from the UART!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps, but where did the '\0' come from. I did not send it and it does not show up on the serial analyzer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the old days the data was sent slow enough the host could keep up so no handshaking. I bet, but can not find in the manual that the RS232 USB dongle uses handshaking signals. Which would be fine if the Cyclone 3 development board passed them through, but why would they do that?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page