Hi
I am using AN1798 to calculate my bit timing. The following are the details of the bus.
Bus Length = 0.4m
Transceiver (NXP, TJA1041) propogation delay = max 255ns
Bit Rate: 125kbps which is well within the capabilities of the transceiver chip
The hardware set up is 3 nodes one is dormant though on the bus and just provides power to the other 2. Each node uses an MCF51JM128 and an NXP TJA1041.
The following is the bit timing information calculated from AN1798.
| BUS CLK (0) or External CLK (1) | 1 |
| Cable Length (m) | 0.4 |
| Tprop_delay_cable | 2.000E-009 |
| Tprop_delay_transceiver | 2.500E-007 |
| Tprop_seg | 5.040E-007 |
| External CLK | 24000000 |
| BUS CLK | 12000000 |
| Prescaler | 16 |
| CAN CLK | 1500000 |
| tQ | 6.67E-007 |
| CAN Bit Rate | 1.25E+005 |
| tQ per Bit | 12 |
| PROP_SEG | 1 |
| Tq per Bit – PROP_SEG – Sync_SEG | 10 |
| PHASE_SEG1 | 5 |
| PHASE_SEG2 | 5 |
| RJW | 4 |
| Oscillator Requirements: EQ10 | 0.0167 |
| EQ11 | 0.0166 |
| Required Oscillator Tolerance | 1.6556% |
Now using these values data passes onto the CAN_H CAN_L lines.
The system is such that node 1 transmits a message onto the bus and then waits for a reply from node 2 in a do while loop:
do
{
if(j==0)
{
while(SendByte(fourPtr)!=0) //this is place marker to show me where the code is over the serial port
{
}
}
j++;
(void)CAN_CheckStatusMB( 2, status ); //check buffer 2 status
}
while ( status[0] != NEWDATA); //if data has been received break out of the do while loop
while(SendByte(fivePtr)!=0) //this is place marker to show me where the code is over the serial port
{
}
(void)CAN_ReadDataMB(2, dataR); //read data from buffer 2
Now I'm not sure where to go to from here short of trying every possible bit timing configuration. I just can't seem to get the silly bus to receive messages can anyone see any issues with my CAN Bit Timing? Please don't hesitate to ask for further information!