Hi, I am interfacing ST10F269 with MCP2515 via SSC module. Please see the routines as below, i am still not able to read valid values from register CANCTRL at address 0x0F. i wish to upload the waveforms but dont see an option here.
initialisation routines : NOP BSET DP3.6 ;Chip Select BSET P3.6 BCLR DP3_8 ;MRST pin BCLR P3_8 BSET DP3_9 ;MTSR pin BSET P3_9 BSET DP3_13 ;SCLK BSET P3_13 MOV SSCBR, #0x00C7 ;100K baudrate BCLR SSCEN MOV SSCCON, #0x4077 BSET SSCEN ENIT CODE : #define MCP_SELECT() (P3_6 = 0) #define MCP_DESELECT() (P3_6 = 1) unsigned int spi_readwrite(BYTE data) { int test = 0; SSCTB = data; //Byte in Sende buffer while(SSCBSY == 0);//wait till SSCBUSY becomes 1 i.e. when transmission starts SSCBSY becomes 1 while (!SSCRIR); //wait till byte is sent(SSCRIR = 1) SSCRIR = 0; //clear the flag return SSCRB ; } unsigned int spi_read(void) { return (spi_readwrite(SPIDONTCARE)); //return SSCRB ; } CALLING FUNCTIONS : MCP_SELECT(); spi_readwrite(0x03); //MCP_READ = 0x03 spi_readwrite(0x0F); status_register = spi_read(); MCP_DESELECT();
Please let me know if i am doing something wrong. Its very urgent.
Rgds Sany
:). thanks for the valuable info. I really really appreciate it. Wont repeat it though. Do i have to post the question again ?
There is no such option here.
You could try posting on the ST site - it looks more of an ST question anyhow, and their forum does allow posting pictures.
IF you do that, provide links between the 2 threads.