From: Feusag M. <feu...@go...> - 2007-09-05 17:20:50
|
Hi, I had the same problem and traced it to the baud rate calculation. It turns out that there is a 7% error at 9600 baud with a 1MHz system clock (see table 60 in the datasheet) and this is out of spec for you PC UART to read. I changed the baud rate on line 22 of template.asm to 4800 (0.2% error) and everything was OK. I have also prototyped the following change to armforth/words/usart.asm to use the U2X double speed mechanism. With this change the error at 9600 baud is 0.2% with a 1MHz clock and works perfectly. Index: usart.asm =================================================================== --- usart.asm (.../vendor/amforth/2.3/words/usart.asm) +++ usart.asm (.../trunk/forth/amforth/words/usart.asm) @@ -81,7 +81,7 @@ .dw XT_D2SLASH .dw XT_D2SLASH .dw XT_D2SLASH - .dw XT_D2SLASH +; .dw XT_D2SLASH ; We are going for 2X, so remove one of these... .dw XT_ROT .dw XT_UMSLASHMOD .dw XT_SWAP @@ -96,7 +96,14 @@ .dw XT_DOLITERAL .dw BAUDRATE0_HIGH .dw XT_CSTORE + .dw XT_DOLITERAL + .dw $02 ; U2X + .dw XT_DOLITERAL + .dw $2B ; UCSRA + .dw XT_CSTORE + + .dw XT_DOLITERAL .dw (1<<UMSEL01)|(3<<UCSZ00) .dw XT_DOLITERAL .dw USART0_C I hope this helps. Cheers Feusag |