[En-Nut-Discussion] SJA1000
Petri Hyötylä
phyotyla at cc.hut.fi
Mon Aug 27 11:23:07 CEST 2007
Hello
I am trying to use SJA1000 with Ethernut 2.1
I tried to test my wiring with the code below and it
was not successful. Please tell me there is a problem with the code.
If not, I will have to recheck my wiring.
--------------------------------------------------------------------
#define SJA_SIGNAL sig_INTERRUPT7
#define SJA_EICR EICRB
#define SJA_SIGNAL_BIT 7
CANFRAME canFrame;
CANINFO *canInfoPtr;
int main(void)
{
u_short base_address = 0x8000;
NutRegisterDevice(&devSJA1000, base_address, 0);
// Set CAN bit rate
CAN_SetSpeed(&devSJA1000, CAN_SPEED_125K);
// Prepare a sample frame for sending
memset(&canFrame, 0, sizeof(canFrame));
canFrame.id = 0x123;
canFrame.len = 8;
canFrame.ext = 0; // Set to 1 to send an extended frame
canFrame.byte[0] = 0x11;
canFrame.byte[1] = 0x22;
canFrame.byte[2] = 0x33;
canFrame.byte[3] = 0x44;
canFrame.byte[4] = 0x55;
canFrame.byte[5] = 0x66;
canFrame.byte[6] = 0x77;
canFrame.byte[7] = 0x88;
while(1)
{
CAN_TxFrame(&devSJA1000, &canFrame);
NutSleep(2000);
}
return 0;
}
--
Petri
More information about the En-Nut-Discussion
mailing list