*********** Setup SPI for EEPROM ******************************************** MOV #(mSPE|mMSTR),SPIC1 ;Enable SPI as master 0,0 CLR SPIC2 MOV #mSPR0,SPIBR ;/4 = 5MHz LDA SPIS ;dummy SPTEF check
OUTBYTE STA SPID ;put data in SPI register BRCLR SPRF,SPIS,* ;wait till sent (or recieved) LDA SPID ;read returned value RTS
Hmmmm.....
I just got caught by this again. Doing another conversion from GP32 to GT16A.
I was using the debugger to find another issue and this caused the problem not to occur. Only when I went back to standalone running did it hang due to the failure to read the status register first. On the debugger it runs OK. The debugger was not displaying the status register at the time so I do not know why the debugger "fixes" the problem.
Hello Thunder and welcome to the fora.
The SPI simply clocks in the level present on the MISO pin at the appropriate clock transition. If an unconnected pin happens to assume a high level, you will see 0xFF as the byte clocked in. No mystery here!
| ection1;} --> while((SPIS & 0x80) != 0x80); (in Transmit function) Im using CRO to test the same. I hav connected 4 probes to 4 corresponding pins of master(No connections between master and slave at this point). But im not able to see the data on the bus. When I run at one shot then the execution hangs at the receive function (Slave side),at the below line ection1;} --> while((SPIS & 0x80) != 0x80); (in receive function). Yes I have initialised the SPI modules at both sides. Below is the code. Master Side: ------------- void spi_init(void) Slave Side: ----------- void spi_init(void) So kindly let me know the prblm. Regards xxx. |
while((SPIS & 0x80) != 0x80); (in receive function).
So kindly let me know the prblm.
Regards
xxx.