This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ST10F269 with MCP2515 via SSC interface

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 ?

    Rgds
    Sany

  • 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.

  • Did you pull RESET# low and high again to establish a hardware reset for MCP2515? Or did you process a software reset for MCP2515?

    Did you initialize SSC module properly?

    Does the SPI waveform fit your suggestion?

  • Well Jack,
    The MCP2515 RESET in my h/w is connected to main µC reset, so the MCP is resetted once while start up and thats it.
    Do i need to reset the chip after initialising it ???
    i tried configuring the pins of micro as GPIO and generated the clock manually and then created an SPI but i got the same behaviour...so i concluded the configuration is almost correct.
    in the timing diagram, all the other signals are as per protocol but except the Slave Out line. its distorted and noisy.

  • its distorted and noisy.
    Well, I think it means the SO pin is always in Hi-Z state. So the MCP2515 does not react to your SPI sequence.

    Check your hardware, especially power supply, reset, and oscillator.

    What's your uC? Is its reset signal high level asserted or low? Note the reset signal of MCP2515 is low level asserted.

  • no its not in hi-impedance state but its showing the same signals as the SI line HOWEVER the voltage level is too suppressed.(a few mV).
    The uC reset is also inverted logic...the uC is ST10F269.

    now i tried another thing, i connected the reset of MCP to one of the port pins P3.5 but when i toggle this pin i get 3.5V for low level and 5V for high level.i think the low level is not sufficient enough to give a reset. anyways i think this is a different issue.

    and hey thanx a very lot for replying. i really really appreciate it.