Chung Shien Chai

MC13213 SRB- SPI to Transceiver Modem

Discussion created by Chung Shien Chai on Feb 4, 2007
Latest reply on Feb 5, 2007 by Chung Shien Chai
hi,

below is 2 subroutine, where:
1. W_Modem is writing to modem register
2. R_Modem is reading from modem register

initially i had set
MOV #$50,SPI1C1 ;enable SPI, Master, no interupt
MOV #0,SPI1C2 ;MSB first, no didirectional
MOV #0,SPI1BR ;highest baud rate
and this setting i never change after initialize.

and Port E bit 2 is is connected to modem CE(chip enable)_bar. so right before write/read operation i low_activate it, and right after finish doing the operation, i high_deactivate it.

my problem is, why i can write to modem register but i cant read from modem register.
for example, i want to read modem IRQ_Status Register (0x24)

so i will
MOV #$A4, SPI4 ;;; for reading, bit 7 must be "1"
JSR R_Modem
after this subroutine, the register 16 bit value should have been stored at my RAM named SPI5, SPI6, right?

the problem is the program TRAPPED at the address label "_G"
i am not sure whether writing to modem register work or not. but at least it can loop out from the subroutine, so i assume it does work. anyone have any idea what's wrong with my "reading-from-modem" subroutine?

could anyone please help me figure this? Thanks.

~.~.~.~ Two subroutine i am talking about:
W_Modem:
BCLR 2,PTED
_A: BRCLR 5,SPI1S,_A
MOV SPI1,SPI1D
_B: BRCLR 5,SPI1S,_B
MOV SPI2,SPI1D
_C: BRCLR 5,SPI1S,_C
MOV SPI3,SPI1D
_D: BRCLR 5,SPI1S,_D
BSET 2,PTED
RTS

R_Modem:
BCLR 2,PTED
_E: BRCLR 5,SPI1S,_E
MOV SPI4,SPI1D
_F: BRCLR 7,SPI1S,_F
MOV SPI1D,SPI5
_G: BRCLR 7,SPI1S,_G ;;; GET TRAPPED HERE
MOV SPI1D,SPI6
BSET 2,PTED
RTS

Outcomes