CAN sample code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN sample code

1,662 Views
bilg
Contributor I
I am hoping that someone has already done some example code for the CAN bus on an 8 bit, e.g.
908GZ60, and would be willing to share it. 
Just something simple, but which contains all the reg setup stuff, to save some time. I would like to hook up an eval board DEMO908GZ60 to an existing CAN bus and see how it plays.
 
thanks
bilg
Labels (1)
0 Kudos
5 Replies

545 Views
bilg
Contributor I
hi
there is an app note AN3034 and software which may help
 
 
0 Kudos

545 Views
Limes
Contributor I
Yes I know this app note but it is for a hcs12 and I have a hc08.
 
I'm using a MCP2551 can transceiver, but it does not work as I want it.
 
Which transceiver are you using?
0 Kudos

545 Views
bilg
Contributor I
I have the demo board DEMO908GZ60 which uses a TJA1054.  I only know of the app note, I haven't gone through it yet,... nor can I speak for the board.  But I would be interested if you want to continue the conversation, maybe off line would be more responsive.
0 Kudos

545 Views
Limes
Contributor I
Why do I send Message 3 and not Message 1?
 
while(CTFLG_TXE0 != 0x01){
 }
 
 IDR00 = 0x00;     //00000000
 IDR10 = 0x18;     //00001000
 IDR20 = 0x04;     //00000100
 IDR30 = 0x41;     //01000000
 DSR00 = 0x12;     //00010010
 DSR10 = 0x34;     //00110100
 DSR20 = 0x56;     //01010110
 DSR30 = 0x78;     //01111000
 DSR40 = 0x9a;     //10011010
 DSR50 = 0x00;
 DSR60 = 0x00;
 DSR70 = 0x00;
 DLR0  = 0x08;
 TBPR0 = 0x00;
 
 
  while(CTFLG_TXE1 != 0x01){
 }
 
 IDR01 = 0x00;     //00000000
 IDR11 = 0x18;     //00001000
 IDR21 = 0x04;     //00000100
 IDR31 = 0x41;     //01000001
 DSR01 = 0x12;     //00010010
 DSR11 = 0x34;     //00110100
 DSR21 = 0x56;     //01010110
 DSR31 = 0x78;     //01111000
 DSR41 = 0x9a;     //10011010
 DSR51 = 0x00;
 DSR61 = 0x00;
 DSR71 = 0x00;
 DLR1  = 0x08;
 TBPR1 = 0x02;
 
 
  while(CTFLG_TXE2 != 0x01){
 }
 
 IDR02 = 0x00;     //00000000
 IDR12 = 0x18;     //00001000
 IDR22 = 0x04;     //00000100
 IDR32 = 0x40;     //01000001
 DSR02 = 0x12;     //00010010
 DSR12 = 0x34;     //00110100
 DSR22 = 0x56;     //01010110
 DSR32 = 0x78;     //01111000
 DSR42 = 0x9a;     //10011010
 DSR52 = 0x00;
 DSR62 = 0x00;
 DSR72 = 0x00;
 DLR2  = 0x05;
 TBPR2 = 0x04;
 
 CTFLG_TXE0 = 0x00;
 
On the CAN-Bus Monitor Message 3 is show but why? I set the TXE0 to 0 TXE3 should be stay high. Were is the mistake? Has anyone had equal problems?
thanks
0 Kudos

545 Views
Limes
Contributor I
Hi
That's a good question. I'm looking also for a CAN sample code for my GZ.
If somebody has some code, please make him public.
Thanks a lot
0 Kudos