AMcTools Forum 
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
software uart recieved wrong bytes. (Read 6548 times)
DreamCat
Junior Member
**
Offline

I love electronic!

Posts: 63

software uart recieved wrong bytes.
01/31/10 at 12:00:14
 
I used a software uart on my mega8, and simulate on VMLAB, it seems like very nice, but when I flashed hex file to my board and do a loop test , there is many wrong bytes feed back..

Start SUART Test !
1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
1234567890ABCDEFGHIJKLMNOPQRSTU?暐?
1234567890ABCDEFGHIJKLS?
%5EUeu厱フ
...........................

so I test mcu send string to my pc , no wrong, so I think the reciever isn't work propely.

but I think it maybe not my program's wrong.

how to resolve this problem? anyone can give me some advice?
Back to top
 
 
  IP Logged
moderator
YaBB Administrator
*****
Offline

I love forums, don't
you?

Posts: 308
AMcTools (Spain)
Gender: male
Re: software uart recieved wrong bytes.
Reply #1 - 01/31/10 at 18:07:05
 
Please, specify a bit better what are you doing:

- Are you using the TTY cell + Mega8

- ... or maybe the COMXCH cell connected to some external device?

I would suggest you in any case to trace in the Scope the digital signals to see at bit level where the trouble is.
Back to top
 
 
WWW   IP Logged
DreamCat
Junior Member
**
Offline

I love electronic!

Posts: 63

Re: software uart recieved wrong bytes.
Reply #2 - 02/01/10 at 04:23:57
 
Thanks your reply!!

I said that it simulate is no wrong.  this problem is not related with VMLAB.  :)

normally, If I simulated success, then no need debug on hardware. but this time, I faild.

and I resolved the problem now!

I notice that it use a high value crystal in the example code, so I think the frequency of crystal is related with baudrate.  today I first re-compiled my program on 3.686MHz and 4800bps, it worked nice.

and then I test it ong 7.3728MHz, 9600bps, It worked also propely ...

it use ICP and OC1A on Mega8 done the receive and transmit.

I think that the time of input capture every bit need much short time of  clock cycle time.




-----------------------------------------------------------
sorry for my bad english!
Back to top
 
 
  IP Logged
DreamCat
Junior Member
**
Offline

I love electronic!

Posts: 63

Re: software uart recieved wrong bytes.
Reply #3 - 02/11/10 at 06:31:06
 
here is the original suart code.

maybe usefull for other people...

Back to top
 
  IP Logged
DreamCat
Junior Member
**
Offline

I love electronic!

Posts: 63

Re: software uart recieved wrong bytes.
Reply #4 - 02/11/10 at 06:34:03
 
And here also have a nice code, but it have some problem when use hardware... I'm not resolved it.

http://www.rn-wissen.de/index.php/Software-UART_mit_avr-gcc

you can use google web translate tool read it .
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print