CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Cant able to get response from MCP2515

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
faraz
Guest







Cant able to get response from MCP2515
PostPosted: Mon Jun 30, 2008 9:55 am     Reply with quote

Hi , i am doing my master Thesis in a German Company. I have a problem with MCP2515 cCan controller, I write a code to interface with Renesas H8SX 1657 controller and i checked every think is right, Command, data and modes are correct but MCP2515 can not response.
i just want to get response from Can controller, in my case nothing is happening :( , i use bit banging instead of Usart .

my code is .

Code:
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

}

Thanks very much if somebody help me out.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 30, 2008 10:31 am     Reply with quote

This forum is for the CCS compiler and Microchip PIC microcontrollers.
It's not a Renesas H8 forum.

Here is the Renesas forum:
http://www.renesasrulz.com/forum/h8
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group