GM ALDL codes & questions
TOM_HUSSEY at HP-Canada-om1.om.hp.com
TOM_HUSSEY at HP-Canada-om1.om.hp.com
Fri Apr 18 13:05:42 GMT 1997
> > The NRZ serial data link at 8192 baud 8/N/1. I wrote a software UART
> > program to look at this interface and got the following types of hex
> > codes:
> >
> > 91 59 00 00 00 00 16
> > 90 5a 25 08 44 44 ff 62 ff
> > oa 58 aa 03 92 5f ff
> >
> > I know that the "03 92" represents 914 RPM in the last frame. The
"44
> > 44" in the second frame are suspect to be temperature. Could anyone
help
> > me with the format decode?
> > The second non OBDII signal on the connector is an input on pin 6.
Can
> > anyone tell me what it is used for?
> >
> > I wrote a routine to extract the data from J1850 pwm format. When I
went
> > to look at the data I found that there is no signal on the pin (pin
2).
> > How is the computer prompted to send data to the J1850 I/O pin?
> >
> > If anyone would like the code I have written let me know. Any assist
on
> > the decoding of the data would be great. Thanks -Tom Hussey
>
> Hey Tom,
>
> Even though I am working on an ALDL project I would be interested in
> seeing your code/schematic for the cable use used. Eventually the
next
> step for me after getting the ALDL down pat would be to add OBDII
> compatibility. So, yes whatever info you could post would be
> appreciated by me and other ECM junkies :)
>
> VTY
> Mark Glicksman
> mglicksm at suffolk.lib.ny.us
>
Hi,
The schematic might be a problem for me to send however I will attempt
to describe it. My single board computer is based on a 68HC11F1CFN4.
There is a 16MHZ oscillator connected to EXTAL input and a 47K load
resistor from XTAL to ground. The mode pins are set for single chip
operation when I am reading info from the car and placed in "special
bootstrap" mode when I reprogram the chip (01 and 00 respectivly for
mode a & mode b). Reset is controlled by a linear tech micro supervisor
chip.
I don't have a laptop (yet) so i installed a printer interface. This is
a standard centronics style connected to port B with the strobe on port
F. Input from the J1850 data stream comes from port A bit 0. I am
attaching the code for you below.
I have seen some posts regarding an input that places older ECMs in test
mode. Some reference to 10K mode etc. Could you help me by describing
the modes and how they are entered? Thanks -Tom Hussey
.HEADER 'J1850 DECODER'
.PAGEWIDTH 132
*
*
************************************************************************
* J1850 DECODE ROUTINE T6
************************************************************************
* APRIL 9 1997
************************************************************************
* REGISTER EQUATES -OFFSET FROM REGISTER BASE, DEFAULT AT $1000
************************************************************************
PORTA EQU $00 ; DEFAULT $00
DDRA EQU $01 ; DEFAULT $00
PORTG EQU $02 ; DEFAULT $00
DDRG EQU $03 ; DEFAULT $00
PORTB EQU $04 ; DEFAULT $00
PORTF EQU $05 ; DEFAULT $00
PORTC EQU $06 ; DEFAULT $00
DDRC EQU $07 ; DEFAULT $00
PORTD EQU $08 ; DEFAULT $00
DDRD EQU $09 ; DEFAULT $00
PORTE EQU $0A ; $XX -NO DEFAULT
CFORC EQU $0B ; DEFAULT $00
OC1M EQU $0C ; DEFAULT $00
OC1D EQU $0D ; DEFAULT $00
TCNT EQU $0E ; DEFAULT $00
TIC1 EQU $10 ; $XX -NO DEFAULT
TIC2 EQU $12 ; $XX -NO DEFAULT
TIC3 EQU $14 ; $XX -NO DEFAULT
TOC1 EQU $16 ; DEFAULT $FF
TOC2 EQU $18 ; DEFAULT $FF
TOC3 EQU $1A ; DEFAULT $FF
TOC4 EQU $1C ; DEFAULT $FF
TI4O5 EQU $1E ; DEFAULT $FF
TCTL1 EQU $20 ; DEFAULT $00
TCTL2 EQU $21 ; DEFAULT $00
TMSK1 EQU $22 ; DEFAULT $00
TFLG1 EQU $23 ; DEFAULT $00
TMSK2 EQU $24 ; DEFAULT $00
TFLG2 EQU $25 ; DEFAULT $00
PACTL EQU $26 ; DEFAULT $00
PACNT EQU $27 ; $XX -NO DEFAULT
SPCR EQU $28 ; DEFAULT %000000UU
SPSR EQU $29 ; DEFAULT $00
SPDR EQU $2A ; $XX -NO DEFAULT
BAUD EQU $2B ; DEFAULT %00000UUU
SCCR1 EQU $2C ; DEFAULT %UU000000
SCCR2 EQU $2D ; DEFAULT $00
SCSR EQU $2E ; DEFAULT $C0
SCDR EQU $2F ; $XX -NO DEFAULT
ADCTL EQU $30 ; DEFAULT %00UUUUUU
ADR1 EQU $31 ; $XX -NO DEFAULT
ADR2 EQU $32 ; $XX -NO DEFAULT
ADR3 EQU $33 ; $XX -NO DEFAULT
ADR4 EQU $34 ; $XX -NO DEFAULT
BPROT EQU $35 ; DEFAULT $1F
OPT2 EQU $38 ; DEFAULT $20
OPTION EQU $39 ; DEFAULT $10
COPRST EQU $3A ; $XX -NO DEFAULT
PPROG EQU $3B ; DEFAULT $00
HPRIO EQU $3C ; DEFAULT $M5
* M DEPENDS ON MODE
INIT EQU $3D ; DEFAULT $01
TEST1 EQU $3E ; NOT USED... TEST
CONFIG EQU $103F ; ABSOLUTE ADDRESS
-EEPROM SET BY PROGRAM
CSSTRH EQU $5C ; DEFAULT $00
CSCTL EQU $5D ; DEFAULT $00 SC
; DEFAULT $04 E/NMM
CSGADR EQU $5E ; DEFAULT $00
CSGSIZ EQU $5F ; DEFAULT $07
************************************************************************
* SINGLE CHIP MODE.
* EQUATES FOR THE 68HC11F1
************************************************************************
RAMSTR EQU $0000
RAMEND EQU $03FF
STKSTR EQU $03EF
BUFSTR EQU $0380
VARSTR EQU $03F0
REGSTR EQU $1000
REGEND EQU $105F
BROMST EQU $BF00
BROMEN EQU $BFFF
EEPSTR EQU $FE00
EEPEND EQU $FFFF
VECSTR EQU $FFD6
VECEND EQU $FFFF
************************************************************************
* EQUATES
************************************************************************
BMASK EQU $01 ; BIT MASK FORINPUT: PORTA BIT 0
PMASK EQU $02 ; PRINTER READY MASK:PORTG BIT 1
SMASK EQU $80 ; PRINTER STROBE MASK:PORTF BIT 7
************************************************************************
* RAM VARIABLES
************************************************************************
ORG VARSTR ; THERE ARE NO VARIABLES FOR THIS
SIMPLE CODE
************************************************************************
* CONFIGURATION REGISTER INITIALIZATION
************************************************************************
ORG CONFIG
FCB $FF ; CONFIG REGISTER
************************************************************************
* INITIALIZATION CODE
************************************************************************
ORG EEPSTR
START EQU *
LDS #STKSTR ; SET STACK
LDX #REGSTR ; INDEX TO REGS
LDY #BUFSTR ; START OF BUF
LDAA #$FC ; SET TO ELIMINATE FLOATING
INPUTS
STAA DDRG,X ; MOST OF G: BIT 0 IS A SWITCH
INPUT
LDAA #$FE ; SET TO OUTPUT
STAA DDRA,X ; MOST OF A: BIT 0 IS THE DATA
INPUT
; : BIT 1 IS PRINTER
READY
LDAA #$FF ; SET ALL OUTPUT
STAA DDRC,X ; ALL OF C
LDAA #$3F ; SET TO OUTPUT
STAA DDRD,X ; PORT D
BSET PORTF,X,SMASK ; INIT THE PRINTER STROBE
************************************************************************
* MAIN CODE LOOP
************************************************************************
LDAA PORTG,X ; READ THE OPERATING MODE
BITA #$01 ; TEST MODE
BEQ SYNC ; BRANCH IF CAPTURE DATA MODE
JMP DUMPR ; ELSE SEND DATA TO THE PRINTER
************************************************************************
* SYNC IS A TIMING LOOP TO RESYNC WITH THE INTER
* FRAME SEPARATION. THE THREE INSTRUCTIONS IN THE
* LOOP TAKE 3US TO EXECUTE. ONCE THIS HAS BEEN DONE
* 96 TIMES, 288US WILL HAVE ELAPSED. DEPENDS ON THE
* FREQUENCY OF 16MHZ FOR A 250NS E CYCLE
************************************************************************
SYNC LDAB #$FF ; SEND FF TO THE DEBUG PORT
STAB PORTC,X ; THIS SHOWS ERRORS OR INIT
LDAB #!96 ; INIT COUNT OF 96 * 3US = 288US
SYN_L BRSET PORTA,X,BMASK,SYNC ; RESTART IF ACTIVE LEVEL SENSED
DECB ; COUNT DOWN TO DETECT INTER
FRAME
BNE SYN_L ; SEPARATION @PASSIVE TV6
BCLR PORTA,X,$80 ; DEBUG = 7FH..WAIT FOR START
IDLE BRCLR PORTA,X,BMASK,* ; WAIT HERE FOR START OF FRAME
LDAB #!11 ; INIT GLITCH COUNT OF 34US
BRA GLI_A ; START READING
GLI_P BRSET PORTA,X,BMASK,SYNC ; ACTIVE = ERROR
DECB ; COUNT DOWN
BNE GLI_P ; FALL THRU = OK
LDAB #!20 ; TV1 - GLITCH
TV1_P BRSET PORTA,X,BMASK,BIT0 ; FOUND A "0" BIT
DECB ; COUNT DOWN FALL
BNE TV1_P ; THRU IF > TV1
LDAB #!22 ; TV2 - TV1 TIME
TV2_P BRSET PORTA,X,BMASK,BIT1 ; FOUND A "1" BIT
DECB ; COUNT DOWN FALL
BNE TV2_P ; THRU IF > TV2
LDAB #!25 ; TV2 - TV3 TIME
TV3_P BRSET PORTA,X,BMASK,EOD ; FOUND EOD
DECB ; COUNT DOWN FALL
BNE TV3_P ; THRU IF > TV3
TV4_P
TV5_P
TV6_P BRA IDLE ; EOF/IFS/IDLE
GLI_A BRCLR PORTA,X,BMASK,SYNC ; PASSIVE = ERROR
DECB ; COUNT DOWN
BNE GLI_A ; FALL THRU = OK
LDAB #!20 ; TV1 - GLITCH
TV1_A BRCLR PORTA,X,BMASK,BIT1 ; FOUND A "1"
DECB ; COUNT DOWN FALL
BNE TV1_A ; THRU IF > TV1
LDAB #!22 ; TV2 - TV1 TIME
TV2_A BRCLR PORTA,X,BMASK,BIT0 ; FOUND A "0"
DECB ; COUNT DOWN FALL
BNE TV2_A ; THRU IF > TV2
LDAB #!25 ; TV2 - TV3 TIME
TV3_A BRCLR PORTA,X,BMASK,SOF ; FOUND A SOF
DECB ; COUNT DOWN FALL
BNE TV3_A ; THRU IF > TV3
TV4_A
TV5_A
TV6_A BRA SYNC ; BREAK DETECTED
************************************************************************
* DATA BITS ARE ACCUMULATED IN THE A REGISTER. THE INITIAL CONDITIONS
ARE
* SET TO $01 SUCH THAT WHEN THE REGISTER HAS HAD EIGHT OPERATIONS WHERE
* BITS ARE ROTATED IN, THE CARRY BIT WILL BE SET. THIS IS USED TO FLAG
* WHEN THE EIGHT BITS ARE READY FOR STORAGE. BITS TO SHIFT IN ARE PLACED
IN
* THE CARRY. A ROLA INSTRUCTION IS USED TO ROTATE DATA FROM THE CARRY
INTO
* THE LAST POSITION (MSB IS SENT FIRST). THE ROTATE OUT FROM BIT 7 IS
PLACED
* IN THE CARRY TO SIGNAL STORAGE OF A COMPLETE BYTE
************************************************************************
BIT0 CLC ; CLEAR CARRY TO SHIFT IN A '0'
BIT
ROLA ; ROTATE THRU ACCA.
BCS SAVE ; IF 8 SHIFTS ARE COMPLETE, STORE
IT
LDAB #!10 ; GLITCH TIME FOR SHIFT DATA
BRA ADJ ; CHECK ACTIVE/PASSIVE AND BRANCH
ADJ BRSET PORTA,X,BMASK,GLI_A ; IF THE INPUT IS ACTIVE BRANCH
DECB ; ADJUST THE GLITCH COUNT DOWN
NOP ; AND PAD THE TIME TO MAKE
NOP ; GLITCH DETECT THE SAME
NOP ; FOR BOTH PASSIVE AND ACTIVE
BRA GLI_P ; INPUT IS PASSIVE
SAVE STAA 0,Y ; STORE THE ASSEMBLED BYTE
STAA PORTC,X ; DEBUG OUTPUT
DEY ; ADJUST POINTER TO NEXT LOCATION
BEQ DONE ; END IF BUFFER IS FULL
LDAA #$01 ; INIT DATA FOR NEXT BYTE
LDAB #!08 ; SET GLITCH COUNT
BRA ADJ ; CHECK ACTIVE/PASSIVE AND BRANCH
BIT1 SEC ; SET CARRY TO SHIFT IN A '1' BIT
ROLA ; ROTATE THRU ACCA.
BCS SAVE ; IF 8 SHIFTS ARE COMPLETE, STORE
IT
LDAB #!10 ; GLITCH TIME FOR SHIFT DATA
BRA ADJ ; CHECK ACTIVE/PASSIVE AND BRANCH
EOD LDAB #!11 ; GLITCH TIME FOR END OF DATA
LDAA #$01 ; SET UP FOR RESPONSE BYTE
BRA ADJ ; CHECK ACTIVE/PASSIVE AND BRANCH
SOF LDAA #$01 ; INIT DATA FOR NEXT BYTE
LDAB #!11 ; GLITCH TIME FOR START OF FRAME
BRA ADJ ; CHECK ACTIVE/PASSIVE AND BRANCH
DONE LDAB #$00 ; DONE FLAG
STAB PORTC,X ; OUTPUT IT
BRA * ; WAIT FOR RESET
DUMPR LDY #BUFSTR ; POINT AT FIRST DATA
PRINT LDAA 0,Y ; READ RAM DATA
BRSET PORTG,X,PMASK,* ; LOOP PRN BUSY
STAA PORTB,X ; DATA TO PRINTER
BCLR PORTF,X,SMASK ; START THE STROBE
BSET PORTF,X,SMASK ; DATA SENT
DEY ; NEXT DATA
BNE PRINT ; LOOP TILL ALL DONE
BRA * ; WAIT FOR RESET
************************************************************************
* INTERRUPT SERVICE ROUTINES
************************************************************************
ISR_N RTI ; UNEXPECTED INT
************************************************************************
* VECTOR TABLE
************************************************************************
ORG VECSTR
FDB ISR_N ; NOT USED -SCI
FDB ISR_N ; NOT USED -SPI
FDB ISR_N ; NOT USED -PA EDGE
FDB ISR_N ; NOT USED -PA OVERFLOW
FDB ISR_N ; NOT USED -T OVERFLOW
FDB ISR_N ; NOT USED -T OC5
FDB ISR_N ; NOT USED -T OC4
FDB ISR_N ; NOT USED -T OC3
FDB ISR_N ; NOT USED -T OC2
FDB ISR_N ; NOT USED -T OC1
FDB ISR_N ; NOT USED -T IC3
FDB ISR_N ; NOT USED -T IC2
FDB ISR_N ; NOT USED -T IC1
FDB ISR_N ; NOT USED -T RTI
FDB ISR_N ; NOT USED -IRQ
FDB ISR_N ; NOT USED -XIRQ
FDB ISR_N ; NOT USED -SWI
FDB ISR_N ; NOT USED -ILLEGA OP
FDB ISR_N ; NOT USED -COP
FDB ISR_N ; NOT USED -CLK MON
FDB START ; RESET VECTOR
More information about the Diy_efi
mailing list