|
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 |
|
From: Feusag M. <feu...@go...> - 2007-09-05 17:22:06
|
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 |
|
From: <r.g...@vi...> - 2007-09-07 10:01:53
|
Hi Feusag, thanks for fast response! I changed init usart routine as You recomended, but I'm not shure that understand You right! Can You send complete routine to me? thanx, Robert > > Od: "Feusag Mhor" <feu...@go...> > Datum: 2007/09/05 sri PM 06:22:08 GMT+01:00 > Za: amf...@li... > Naslov: Re: [Amforth-devel] mega8 installation problem > > 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 > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > |
|
From: Feusag M. <feu...@go...> - 2007-09-07 13:36:25
|
Hi Robert,
It looks like I had some problems posting my original response, and
unfortunatley the layout of the diff is not very clear...
Anyway, here is the complete text of my modified uart initialize route
from words/usart.asm - starting around line 50. This is just a
prototype of the change so it has literal values for the new register
values and very few comments, but it should let you get running.
; ( -- ) Hardware Access
; R( --)
; initialize usart0
VE_USART0:
.db $06, "usart0",0
.dw VE_HEAD
.set VE_HEAD = VE_USART0
XT_USART0:
.dw DO_COLON
PFA_USART0: ; ( -- )
.dw XT_ZERO
.dw XT_DOLITERAL
.dw usart0_tx_in
.dw XT_CSTORE
.dw XT_ZERO
.dw XT_DOLITERAL
.dw usart0_tx_out
.dw XT_CSTORE
.dw XT_ZERO
.dw XT_DOLITERAL
.dw usart0_rx_in
.dw XT_CSTORE
.dw XT_ZERO
.dw XT_DOLITERAL
.dw usart0_rx_out
.dw XT_CSTORE
.dw XT_F_CPU
.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
.dw XT_DROP
.dw XT_1MINUS
.dw XT_DUP
.dw XT_DOLITERAL
.dw BAUDRATE0_LOW
.dw XT_CSTORE
.dw XT_BYTESWAP
.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
.dw XT_CSTORE
.dw XT_DOLITERAL
.dw (1<<TXEN0) | (1<<RXEN0) | (1<<RXCIE0)
.dw XT_DOLITERAL
.dw USART0_B
.dw XT_CSTORE
; set IO
.dw XT_DOLITERAL
.dw XT_TX0
.dw XT_DOLITERAL
.dw XT_EMIT
.dw XT_DEFERSTORE
.dw XT_DOLITERAL
.dw XT_TX0Q
.dw XT_DOLITERAL
.dw XT_EMITQ
.dw XT_DEFERSTORE
.dw XT_DOLITERAL
.dw XT_RX0
.dw XT_DOLITERAL
.dw XT_KEY
.dw XT_DEFERSTORE
.dw XT_DOLITERAL
.dw XT_RX0Q
.dw XT_DOLITERAL
.dw XT_KEYQ
.dw XT_DEFERSTORE
.dw XT_DOLITERAL
.dw XT_NOOP
.dw XT_DOLITERAL
.dw XT_SLASHKEY
.dw XT_DEFERSTORE
.dw XT_EXIT
Enjoy ;o)
Feusag
|
|
From: <r.g...@vi...> - 2007-09-10 11:50:10
|
Hi to all!
After changing user initialisation routine, installing quartz and without any answer
from my mega8, I try to check source in avr studio simulator and found out that
after 1507 clock ticks avr simulator execute wrong opcode and reset.
After tracing in which routine I came to this:
; ( i*x -- j*x )
; R( -- )
; runtime of defer
;VE_DOEDEFER:
; .db $0a, "(defer)", 0
; .dw VE_HEAD
; .set VE_HEAD = VE_DOEDEFER
XT_DODEFER:
.dw PFA_DODEFER
PFA_DODEFER:
call_ DO_DODOES
.dw XT_DUP
.dw XT_1MINUS
.dw XT_SWAP
.dw XT_1PLUS
.dw XT_IFETCH
.dw XT_EXECUTE
; .dw XT_EXECUTE
.dw XT_EXIT
On second XT_execute aperas executing wrong opcode, so after commenting
out this line in simulator works ok.
This evening I will try in real Mega....
Is there falut or not?
>
> Od: <r.g...@vi...>
> Datum: 2007/09/05 sri PM 02:23:05 GMT+01:00
> Za: <amf...@li...>
> Naslov: [Amforth-devel] mega8 installation problem
>
> Dear all,
> I will need a help from you as I have a problem with installing amforth2.3 on
> atmega8.
> Assembling with avr studio 4 is performed without any error. I put cpu
> frequency t
> o 1Mhz (internal rc oscilator) , baud rate at 9600. After programming with hex
> and
> eeprom files, nothing hapened, on hyper terminal is nothing writen neider
> typing on
> kbd helped.
> I'm using internal oscilator seted to 1Mhz, with rs232 attached to pin 2 and 3
> of
> atmega8. If I load atmega8 with any program (writen in C or asm) for serial
> communication (simly sending and receiving characters from hyperterminal),
there
> is print out on hyperterminal so rs232 chip is properly
> connected to avr.
> Does anyone have any ideo what is wrong?
> I was very happy when found amforth and now it does not want to work...... :-(
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Amforth-devel mailing list
> Amf...@li...
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>
>
|
|
From: Matthias T. <mt...@we...> - 2007-09-14 11:43:18
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
r.g...@vi... schrieb:
> Hi to all!
> After changing user initialisation routine, installing quartz and without any answer
> from my mega8
I've just checked the sources with an Atmega8: With an 8 MHz quartz
everything works fine.
- ------------------------------
Welcome to minicom 2.2
OPTIONS: I18n
Compiled on Mar 7 2007, 15:10:03.
Port /dev/ttyS0
Press CTRL-A Z for help on special keys
amforth 2.4 ATmega8
> words
d2/ d>s s>d up! up@ 0 1ms >< cmove> i! i@ unloop i sp! sp@ rp! rp@ +! ...
>
- -------------------------------
If you do not depend on 1MHz you may change the fuses to use the 8MHz
internal RC oszillator (http://palmavr.sourceforge.net/cgi-bin/fc.cgi
can be helpful to get the correct fuse values)
Greetings
Matthias
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFG6nPI9bEHdGEMFjMRAoDMAKC0pglXgvQrcg+/A3uvD48baSO9XQCdEV9J
7iDprF9UU7aU37TtlIlxhdY=
=OQR1
-----END PGP SIGNATURE-----
|
|
From: robi <r.g...@vi...> - 2007-09-15 18:19:06
|
Thank you Matthias! I will check my fuses according this web site. Can You send me hex files for mega8 at 8mhz with external quartz? Also I will try programing on other programmer. Thanks a lot, Robert On Fri, 2007-09-14 at 13:43 +0200, Matthias Trute wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > r.g...@vi... schrieb: > > Hi to all! > > After changing user initialisation routine, installing quartz and without any answer > > from my mega8 > > I've just checked the sources with an Atmega8: With an 8 MHz quartz > everything works fine. > > - ------------------------------ > Welcome to minicom 2.2 > > OPTIONS: I18n > Compiled on Mar 7 2007, 15:10:03. > Port /dev/ttyS0 > > Press CTRL-A Z for help on special keys > > amforth 2.4 ATmega8 > > words > d2/ d>s s>d up! up@ 0 1ms >< cmove> i! i@ unloop i sp! sp@ rp! rp@ +! ... > > > > - ------------------------------- > > If you do not depend on 1MHz you may change the fuses to use the 8MHz > internal RC oszillator (http://palmavr.sourceforge.net/cgi-bin/fc.cgi > can be helpful to get the correct fuse values) > > Greetings > Matthias > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFG6nPI9bEHdGEMFjMRAoDMAKC0pglXgvQrcg+/A3uvD48baSO9XQCdEV9J > 7iDprF9UU7aU37TtlIlxhdY= > =OQR1 > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |
|
From: robi <r.g...@vi...> - 2007-09-20 18:38:04
|
Finally, I found enough time to set up fuses and now amforth is working properly on mega8 at 8Mhz quartz! Thanks a lot Feusag and Matthias! excellent piece of sw!! best regards, Robert On Sat, 2007-09-15 at 20:21 +0200, robi wrote: > Thank you Matthias! > I will check my fuses according this web site. > Can You send me hex files for mega8 at 8mhz with external quartz? > Also I will try programing on other programmer. > Thanks a lot, > Robert > > On Fri, 2007-09-14 at 13:43 +0200, Matthias Trute wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > r.g...@vi... schrieb: > > > Hi to all! > > > After changing user initialisation routine, installing quartz and without any answer > > > from my mega8 > > > > I've just checked the sources with an Atmega8: With an 8 MHz quartz > > everything works fine. > > > > - ------------------------------ > > Welcome to minicom 2.2 > > > > OPTIONS: I18n > > Compiled on Mar 7 2007, 15:10:03. > > Port /dev/ttyS0 > > > > Press CTRL-A Z for help on special keys > > > > amforth 2.4 ATmega8 > > > words > > d2/ d>s s>d up! up@ 0 1ms >< cmove> i! i@ unloop i sp! sp@ rp! rp@ +! ... > > > > > > > - ------------------------------- > > > > If you do not depend on 1MHz you may change the fuses to use the 8MHz > > internal RC oszillator (http://palmavr.sourceforge.net/cgi-bin/fc.cgi > > can be helpful to get the correct fuse values) > > > > Greetings > > Matthias > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.6 (GNU/Linux) > > > > iD8DBQFG6nPI9bEHdGEMFjMRAoDMAKC0pglXgvQrcg+/A3uvD48baSO9XQCdEV9J > > 7iDprF9UU7aU37TtlIlxhdY= > > =OQR1 > > -----END PGP SIGNATURE----- > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2005. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Amforth-devel mailing list > > Amf...@li... > > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |