strange crash?
Zamuel
Posts: 7
I have a project there I use a SX28 to interface with a SRAM memory to read and write data and I use port A for read/ write signals and such stuff and PORT B and PORT C f
Comments
It might be the read-modify-write problem that is commonly known.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
I made a loop that just goes thru all memory locations and sets the outputs with the number from the counter (0-255) and then make the pins inputs and read whatever is there. It worked fine upto about 230 loops, after that it crashed more often.
The reset input is just connected to a DS1813 reset circuit and nothing else so it looks like the resetsignal is set by the sx28 itself. I forced the resetpin high with a direct connection to 5 volt and then it worked, until I removed the voltage, then it droped to zero and made a reset and now that was after my program had stoped (it worked fine and stoped with the 5V connected) so I guess the sx28 can reset itself and had latch that signal so then I removed my 5 volt it made a reset.
I didn't know the sx28 could do that and I don't understand what could make it reset
There are alot's of "dummy" nops in some routines that I put in to prevent the "read modify write" problem, but it didn't make any difference
The loop works ok upto about 230, above that and it's very unstable and if I run it for about 250 loops it never works. The loop should go on for 65536 loops and it worked then I forced the resetpin high. I just checked pin 8 (BUSY signal) with a voltmeter. If it stays low it's ok, if it goes high, then the sx28 made a reset
;
DEVICE DIRECTIVES
DEVICE SX28,OSCHS3,TURBO
IFDEF __SASM ;SASM Directives
DEVICE STACKX,OPTIONX
IRC_CAL IRC_SLOW
ELSE ;Parallax Assembler Directives
DEVICE STACKX_OPTIONX
ENDIF
RESET initialize
;
DEBUG SETTINGS
FREQ 4_000_000
;
VARIABLES
data_low EQU $08
data_high EQU $09
temp EQU $0E
ORG $000
;
INITIALIZATION ROUTINE
WE EQU RA.3
OE EQU RA.2
BUSY EQU RA.1
ADDR_EN EQU RA.0
A0A7 EQU RB
A8A15 EQU RC
D0D7 EQU RB
D8D15 EQU RC
;Port signals
SX_LOAD_ADDR_EN MACRO
setb ADDR_EN
ENDM
SX_LOAD_ADDR_DI MACRO
clrb ADDR_EN
ENDM
SX_OE_HIGH MACRO
setb OE
ENDM
SX_OE_LOW MACRO
clrb OE
ENDM
SX_WE_HIGH MACRO
setb WE
ENDM
SX_WE_LOW MACRO
clrb WE
ENDM
;Set RAM address A0-A15
SETADDR MACRO ADDRH ADDRL
nop
nop
mov !A0A7,#$00 ;Port B all outputs, LOW
nop
nop
mov !A8A15,#$00 ;Port C all outputs, HIGH
nop
nop
mov A0A7,ADDRL
nop
nop
mov A8A15,ADDRH
nop
nop
SX_LOAD_ADDR_EN
nop
nop
nop
nop
nop
SX_LOAD_ADDR_DI
nop
nop
ENDM
;Read data from D0-D15 to DESTH and DESTL
READ_DATA MACRO DESTH,DESTL
mov !A0A7,#$FF ;Port B all inputs, LOW
mov !A8A15,#$FF ;Port C all inputs, HIGH
nop
nop
nop
SX_OE_LOW ;Read data
nop ;1 nop r