Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

uart

Altera_Forum
Honored Contributor II
1,188 Views

hi all, 

 

has anybody seen a problem where bit 7 received for incoming characters appears wrong? 

 

using a niosii 50MHz and adding a uart with 9600 8,n,1 hooking it up to Hyperterminal on windows pc 

with the following running on the nios... 

 

FILE *fp; 

 

fp = fopen(UART1_NAME, "r+"); 

if(fp == NULL) 

printf("error opening dev/uart1\n"); 

else 

while(1) 

printf("%c", getc(fp)); 

 

looking at the console in the IDE I see the following... (any character I type sometimes appears with bit 7 set to 1 and thus the garbage character)? 

 

aaáaáaáa 

eeåeåeåeå 

iiéiéiéiéiéiéiéiéiéiéiéiéié 

ooïoïoïoïoïoïoïoïoïoïo 

uuõuõuõuõuõu 

qqñqñqñqñqww÷w÷w÷w÷w÷w÷eeåeåeå 

 

there is even some pattern to it..... if I press a "new" character i get it 1st two taps on the keyboard - after that the bit 7 received by the NIOS toggles for each one? 

 

Thanks for any advice!!! 

 

Regards, 

 

 

Joe
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
476 Views

This looks suspiciously like the UART baud divisor is incorrect. The divisor is calculated based on the clock speed you enter into SOPC Builder at system-generation-time. You might make sure that your SOPC Builder system is re-generated & quartus project re-compiled (to ensure that the baud divisor is properly set in the FPGA), and then that your oscillator/PLL is driving 50Mhz, not 50.02 or 49.98....

0 Kudos
Altera_Forum
Honored Contributor II
476 Views

The Nios Uart is fine! The divisor is set correctly,etc. 

 

The problem is with the HyperTerminal program. While I can send entire text files down to the Nios without a problem, that behaviour I mentioned with the same characters still occurs..... crazy. 

 

I tried an old DOS terminal program in a DOS-box and it behaves fine!! 

 

Thanks for your attention though! 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif  

 

ps. any recommended Terminal programs out there for Windoze?
0 Kudos
Altera_Forum
Honored Contributor II
476 Views

How often will you be talking to your system via the uart? If the answer is alot you may want to create your own software to talk to it. Then you can make it do whatever you want (like file I/O for example). 

 

What were your connection settings in Hyperterminal? Usually that program is stable and this sounds bad. If your bit 7 is set then I would expect those funny characters (part of the extended ASCII set).
0 Kudos
Altera_Forum
Honored Contributor II
476 Views

I recomend TeraTerm Pro. It is free, can be used as serial and network terminal (SSH, ...) and it works. 

 

http://www.ayera.com/teraterm/ (http://www.ayera.com/teraterm/

 

have fun
0 Kudos
Altera_Forum
Honored Contributor II
476 Views

Yes, that teraterm program work okay. 

 

For the record, I have tried my experiment several times with hyperterminal - setting it for 9600, n,8,1 with no flow control,etc..... (same settings as with the DOS program and this new teraterm).... also no terminal emulation (TTY) is selected. 

 

As I say - complete files can be transferred etc without a problem - only by tapping the same key (tap as fast or slow as you like!) will give the toggling bit 7 after the first two new characters.....!  

 

Thanks for all the help. 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Reply