View previous topic :: View next topic |
Author |
Message |
Raúl Virutas
Joined: 20 Sep 2005 Posts: 2
|
CAN bus problem¡¡¡¡¡Help¡¡¡¡ |
Posted: Wed Sep 21, 2005 12:13 pm |
|
|
Hello everybody!!... and sorry for my english!!!
I'm a spanish student. I have a pcb with a PIC microcontroller (18C458)(20MHz) that uses a Phillips PCA82C250 transceiver. We are using CCS CAN libraries with MPLAB IDE to develop a domotic application, different nodes in this network comunicate with CAN protocol.
My program send a frame every 20 sec. and receive frames via interrupts.
Problem is I load succesfully trx buffer with can_putd function but data doesn't exit to bus because there is a "bus error" ->
bit TXBnCON.TXERR = 1 and so bit TXREQ remains 1.
Can somebody show me his code, i.e. bus initialization, in order to compare and try to find some mistake???
thanks!!!!!
my email is rauvape@epsa.upv.es _________________ understanding CAN¡¡¡¡ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 21, 2005 12:24 pm |
|
|
Do you have a 120 ohm resistor connected between CAN_H and CAN_L
on each end of the CAN bus ? These resistors are required.
See the section on Bus Termination in the following page:
http://www.kvaser.com/index.htm |
|
|
Raúl Virutas
Joined: 20 Sep 2005 Posts: 2
|
|
Posted: Thu Sep 22, 2005 8:23 am |
|
|
Hello¡ and thanks for your response.
We have the mentioned 120 ohms resistors attached betwen CANH and CANL. I think the problem is bus initialization...I will continue investigating it... thanks _________________ understanding CAN¡¡¡¡ |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Thu Sep 22, 2005 9:46 am |
|
|
Perhaps the problem lies with the bus. Normally the transceiver chip requires some kind on acknowledgement from another device on the bus. For instance, if you send a single message with nothing else on the bus, the message will be continually transmitted (scope). Perhaps this is the bus error you are seeing. |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Thu Sep 22, 2005 9:56 am |
|
|
My bad, I didn't read your initial email correctly.
Start with small steps. Try to isolate the problem to the device or the bus (divide and conquer approach). If you connect the terminating resistors only to your device (CAN_H, CAN_L), do you see any data transmitted when you send a message? Did you call can_init()? Do you have any known good devices in which to test the bus? Physical bus length may violate CAN spec? |
|
|
|