brian
01-08-08, 11:59 AM
I'm experiencing a really frustrating issue when trying to download some of
my programs on an IsoPod V2 IsoMax V0.6. I'm using ZTerm and a Keyspan adapter. When I paste my program into ZTerm, it will get to a certain spot
in the download and complain that a defined word is not recognized. The
defined word is tagged as 'OK' when it's downloaded, but when it's referenced later, it's not found. The spelling, case, etc are correct. If I cut-and-paste
just sections at a time, such as the definition, then the code that uses it, it works. It only seems to be when I download the whole thing at once, although even when doing section at a time, I get weird failures like this in other spots.
This seems like a serial port issue, but I've tried putting large delays between
characters and lines, and the point of failures seems to move depending on the delays. I have many other programs that download just fine with the same
setup. I've included the code that has the problem, along with a snapshot of
the download.
( 1 ms state schedule
DECIMAL 5000 PERIOD EEWORD
FVARIABLE fFiltAcc EEWORD
FVARIABLE fFiltGyro EEWORD
FVARIABLE fVoltsAcc EEWORD
FVARIABLE fVoltsGyro EEWORD
( Average over 10 1ms samples
( First filter term ... 9/10
0.9E0 FCONSTANT T1 EEWORD
( Second filter term ... 1 - 9/10
0.1E0 FCONSTANT T2 EEWORD
: ReadAcc ADC0 ANALOGIN ; EEWORD
: ReadGyro ADC1 ANALOGIN ; EEWORD
: LOOPVAR <BUILDS HERE P, DUP , , DOES> P@ ; EEWORD
: DEC&TEST?
DUP 1-! DUP @ 0= IF
DUP 1 + @ SWAP ! TRUE
ELSE DROP FALSE THEN
;
EEWORD
( Filter: FilterVal = current reading * T2
( + previous FilterVal * T1
: AccSum ReadAcc S>F T2 F* fFiltAcc F@ T1 F* F+ fFiltAcc F! ; EEWORD
: GyroSum ReadGyro S>F T2 F* fFiltGyro F@ T1 F* F+ fFiltGyro F! ; EEWORD
( Delay to compute output such that we output every 20 ms .. 50 Hz
DECIMAL 10 LOOPVAR CNT EEWORD
MACHINE IMU_SAMPLER EEWORD
ON-MACHINE IMU_SAMPLER
APPEND-STATE INIT_FILTER EEWORD
APPEND-STATE FILTER_CYCLE EEWORD
APPEND-STATE UPDATE_CYCLE EEWORD
GRNLED OFF EEWORD
REDLED OFF EEWORD
YELLED OFF EEWORD
(
IN-STATE INIT_FILTER CONDITION TRUE
CAUSES
ReadAcc S>F fFiltAcc @ F!
ReadGyro S>F fFiltGyro @ F!
THEN-STATE FILTER_CYCLE TO-HAPPEN
( 1 ms sample rate for filter.
IN-STATE FILTER_CYCLE CONDITION TRUE
CAUSES
AccSum
GyroSum
YELLED OFF
GRNLED ON
THEN-STATE UPDATE_CYCLE TO-HAPPEN
IN-EE
( Output every 20 ms ... 50 Hz for Kalman filter
IN-STATE UPDATE_CYCLE CONDITION CNT DEC&TEST?
CAUSES
fFiltAcc F@ 3.3E0 F* 32760.0E0 F/ fVoltsAcc F!
fFiltGyro F@ 3.3E0 F* 32760.0E0 F/ fVoltsGyro F!
fVoltsAcc F@ F. SPACE fVoltsGyro F@ F. CR
YELLED ON
GRNLED OFF
THEN-STATE FILTER_CYCLE TO-HAPPEN
IN_EE
: HIGHBAUD 57600 SCI0 BAUD ; EEWORD
: MAIN
HIGHBAUD
INIT_FILTER SET-STATE
INSTALL IMU_SAMPLER
; EEWORD
HEX 3C00 AUTOSTART MAIN
SAVE-RAM
The download:
OK
SCRUB
IsoMax V0.6
( Derived from InvPendFilt.txt. This program samples the SparkFun IMU OK
( x-axis and gyro, and filters these values using the Weighted OK
( Average filter. OK
OK
OK
( 1 ms state schedule OK
OK
DECIMAL 5000 PERIOD EEWORD OK
OK
FVARIABLE fFiltAcc EEWORD OK
FVARIABLE fFiltGyro EEWORD OK
OK
FVARIABLE fVoltsAcc EEWORD OK
FVARIABLE fVoltsGyro EEWORD OK
OK
( Average over 10 1ms samples OK
OK
( First filter term ... 9/10 OK
0.9E0 FCONSTANT T1 EEWORD OK
( Second filter term ... 1 - 9/10 OK
0.1E0 FCONSTANT T2 EEWORD OK
OK
: ReadAcc ADC0 ANALOGIN ; EEWORD OK
: ReadGyro ADC1 ANALOGIN ; EEWORD OK
OK
: LOOPVAR <BUILDS HERE P, DUP , , DOES> P@ ; EEWORD OK
OK
: DEC&TEST?
DUP 1-! DUP @ 0= IF
DUP 1 + @ SWAP ! TRUE
ELSE DROP FALSE THEN
; OK
EEWORD OK
OK
( Filter: FilterVal = current reading * T2 OK
( + previous FilterVal * T1 OK
OK
: AccSum ReadAcc S>F T2 F* fFiltAcc F@ T1 F* F+ fFiltAcc F! ; EEWORD
ReadAcc ?
OK
: GyroSum ReadGyro S>F T2 F* fFiltGyro F@ T1 F* F+ fFiltGyro F! ; EEWORD
It hangs at that last line. The same thing happens if I use a different dumb
terminal program to download. If I cut-and-paste the code up to the point
before these last two word definitions, I can then successfully paste these definitions in. This is at 9600 baud. I've tried 1/60th sec between chars with
1/6 sec between lines. Also tried the wait-for-echo checkbox in ZTerm. When using wait-for-echo, the failure occurs down in the GRNLED OFF statement. Much of this code is copied from my other programs which
download just fine. Any suggestions at to what the problem is?
my programs on an IsoPod V2 IsoMax V0.6. I'm using ZTerm and a Keyspan adapter. When I paste my program into ZTerm, it will get to a certain spot
in the download and complain that a defined word is not recognized. The
defined word is tagged as 'OK' when it's downloaded, but when it's referenced later, it's not found. The spelling, case, etc are correct. If I cut-and-paste
just sections at a time, such as the definition, then the code that uses it, it works. It only seems to be when I download the whole thing at once, although even when doing section at a time, I get weird failures like this in other spots.
This seems like a serial port issue, but I've tried putting large delays between
characters and lines, and the point of failures seems to move depending on the delays. I have many other programs that download just fine with the same
setup. I've included the code that has the problem, along with a snapshot of
the download.
( 1 ms state schedule
DECIMAL 5000 PERIOD EEWORD
FVARIABLE fFiltAcc EEWORD
FVARIABLE fFiltGyro EEWORD
FVARIABLE fVoltsAcc EEWORD
FVARIABLE fVoltsGyro EEWORD
( Average over 10 1ms samples
( First filter term ... 9/10
0.9E0 FCONSTANT T1 EEWORD
( Second filter term ... 1 - 9/10
0.1E0 FCONSTANT T2 EEWORD
: ReadAcc ADC0 ANALOGIN ; EEWORD
: ReadGyro ADC1 ANALOGIN ; EEWORD
: LOOPVAR <BUILDS HERE P, DUP , , DOES> P@ ; EEWORD
: DEC&TEST?
DUP 1-! DUP @ 0= IF
DUP 1 + @ SWAP ! TRUE
ELSE DROP FALSE THEN
;
EEWORD
( Filter: FilterVal = current reading * T2
( + previous FilterVal * T1
: AccSum ReadAcc S>F T2 F* fFiltAcc F@ T1 F* F+ fFiltAcc F! ; EEWORD
: GyroSum ReadGyro S>F T2 F* fFiltGyro F@ T1 F* F+ fFiltGyro F! ; EEWORD
( Delay to compute output such that we output every 20 ms .. 50 Hz
DECIMAL 10 LOOPVAR CNT EEWORD
MACHINE IMU_SAMPLER EEWORD
ON-MACHINE IMU_SAMPLER
APPEND-STATE INIT_FILTER EEWORD
APPEND-STATE FILTER_CYCLE EEWORD
APPEND-STATE UPDATE_CYCLE EEWORD
GRNLED OFF EEWORD
REDLED OFF EEWORD
YELLED OFF EEWORD
(
IN-STATE INIT_FILTER CONDITION TRUE
CAUSES
ReadAcc S>F fFiltAcc @ F!
ReadGyro S>F fFiltGyro @ F!
THEN-STATE FILTER_CYCLE TO-HAPPEN
( 1 ms sample rate for filter.
IN-STATE FILTER_CYCLE CONDITION TRUE
CAUSES
AccSum
GyroSum
YELLED OFF
GRNLED ON
THEN-STATE UPDATE_CYCLE TO-HAPPEN
IN-EE
( Output every 20 ms ... 50 Hz for Kalman filter
IN-STATE UPDATE_CYCLE CONDITION CNT DEC&TEST?
CAUSES
fFiltAcc F@ 3.3E0 F* 32760.0E0 F/ fVoltsAcc F!
fFiltGyro F@ 3.3E0 F* 32760.0E0 F/ fVoltsGyro F!
fVoltsAcc F@ F. SPACE fVoltsGyro F@ F. CR
YELLED ON
GRNLED OFF
THEN-STATE FILTER_CYCLE TO-HAPPEN
IN_EE
: HIGHBAUD 57600 SCI0 BAUD ; EEWORD
: MAIN
HIGHBAUD
INIT_FILTER SET-STATE
INSTALL IMU_SAMPLER
; EEWORD
HEX 3C00 AUTOSTART MAIN
SAVE-RAM
The download:
OK
SCRUB
IsoMax V0.6
( Derived from InvPendFilt.txt. This program samples the SparkFun IMU OK
( x-axis and gyro, and filters these values using the Weighted OK
( Average filter. OK
OK
OK
( 1 ms state schedule OK
OK
DECIMAL 5000 PERIOD EEWORD OK
OK
FVARIABLE fFiltAcc EEWORD OK
FVARIABLE fFiltGyro EEWORD OK
OK
FVARIABLE fVoltsAcc EEWORD OK
FVARIABLE fVoltsGyro EEWORD OK
OK
( Average over 10 1ms samples OK
OK
( First filter term ... 9/10 OK
0.9E0 FCONSTANT T1 EEWORD OK
( Second filter term ... 1 - 9/10 OK
0.1E0 FCONSTANT T2 EEWORD OK
OK
: ReadAcc ADC0 ANALOGIN ; EEWORD OK
: ReadGyro ADC1 ANALOGIN ; EEWORD OK
OK
: LOOPVAR <BUILDS HERE P, DUP , , DOES> P@ ; EEWORD OK
OK
: DEC&TEST?
DUP 1-! DUP @ 0= IF
DUP 1 + @ SWAP ! TRUE
ELSE DROP FALSE THEN
; OK
EEWORD OK
OK
( Filter: FilterVal = current reading * T2 OK
( + previous FilterVal * T1 OK
OK
: AccSum ReadAcc S>F T2 F* fFiltAcc F@ T1 F* F+ fFiltAcc F! ; EEWORD
ReadAcc ?
OK
: GyroSum ReadGyro S>F T2 F* fFiltGyro F@ T1 F* F+ fFiltGyro F! ; EEWORD
It hangs at that last line. The same thing happens if I use a different dumb
terminal program to download. If I cut-and-paste the code up to the point
before these last two word definitions, I can then successfully paste these definitions in. This is at 9600 baud. I've tried 1/60th sec between chars with
1/6 sec between lines. Also tried the wait-for-echo checkbox in ZTerm. When using wait-for-echo, the failure occurs down in the GRNLED OFF statement. Much of this code is copied from my other programs which
download just fine. Any suggestions at to what the problem is?