Personal tools
You are here: Home Forums H8 Can not get response From MCP2515

Can not get response From MCP2515

Up to H8

Can not get response From MCP2515

Posted by faraz at July 01. 2008

Hi ,

I am doing my master Thesis in a German Company , My problem is I write code for MCP2515 Can controller using REnesas H8SX 1657 controller , (Bit Banging)   ,  i check each and evry think , data and command output correctly, i also check CS pin also working accordingly , Clock also appear on oscilloscope according to my code. but problem is still i can not communicate with Can controller , because there is no response from Can controller ........I am thinkins this is a Crystal Oscillator problem MAY BE , because  i checked Signals on Crystall it does not shows proper square wave clock.......but i changed each and every component still the behaviour is same .....

My code is

void init_MCP2515_communication(void)
{
  SPI_Init();
  }

unsigned char read_can_reg(unsigned char adr)
{
  unsigned char ret;
  SPI_CS_CAN = 0;                  //Enable Can controller
  SPI_WriteC(MCP_READ);           
  SPI_WriteC(adr);
  ret=SPI_Read();
  SPI_CS_CAN = 1;
  return ret;
}


void write_can_reg(unsigned char adr, unsigned char dat)
{
   SPI_CS_CAN = 0;
   SPI_WriteC(MCP_WRITE);
   SPI_WriteC(adr);
   SPI_WriteC(dat);
   SPI_CS_CAN = 1;
}

int main(void)   {
init_MCP2515_communication();


 write_can_reg(0x0F,0x80);                //set configuration mode
  write_can_reg(0x2A,3);                 //set cnf1 bits
  Test=0x00;
  write_can_reg(0x0F,0x00);                //set normal mode

Test=read_can_reg(0x2A);

return 0

}

Much thanks in advance If some body help me ....

Re: Can not get response From MCP2515

Posted by faraz at July 01. 2008

Problem Has been solved , its actually crystal oscillator problem , i was using 150 PF  capacitor which  did nnot start the MCP2515 , now i use 33 PF  , all works fine . :)

Re: Can not get response From MCP2515

Posted by Calvin Grier at July 01. 2008

Are you writing your own CAN API to communicate via the MCP2515? How fast are you running the SPI bus?

I'm also curious to know what debugging tools you are using... do you have an E10A emulator?

Re: Can not get response From MCP2515

Posted by faraz at July 03. 2008

Hi , No actually i am working on a company product which they are going to launch in the market very soon  , my task is to evaluate different  products  over CAN network, using LABWINDOWS , In SPI i have to use bit banging because schematic of the product is already developed , i have to go according to the hardware , at the moment hardware testing is going on after that actual task will start , so Wish me Good luck . Master Clock frequency is  approximately  1 MHZ ,   crystal is 16 MHZ ..........using   CAN API with hardware which has  SJA1000T  can controller. Yes also use Emulator E10A

Powered by Ploneboard