Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: CAN messages delayed by one?

2004-11-21 by mahlerweb

Hi Robert,

are you sure, that not another nodes sends any ID before your 
external node ? 
The CAN-Core contains a internal Buffer with about 64 Bytes 
(descriped at  SJA1000, should be the same at LPC ). So if your 
Buffer contains any other data  which were received from a previous 
message, you will get this one.  
In normal case you should receive messages like this :      

while((CAN1GSR  & 0x01) == 0x01) {		
     QueueCAN1Out();
     CAN1CMR |= 0x04;		
}

hope it helps,

Peter






--- In lpc2000@yahoogroups.com, Robert Wood <robert.wood@a...> wrote:
> Hi folks,
> 
> First off, I'm using the LPC2294.
> 
> I am finding my CAN messages seemingly delayed by one message. In 
my main loop 
> I have:
> 
> if ((CAN1GSR  & 0x01) == 0x01)		
> 		{		
> 		QueueCAN1Out();		// Queue up the received  
message to send out of the UART.
> 		CAN1CMR |= 0x04;		// Clear the had 
frame bit
> 		}
> 
> The call to QueueCAN1Out is triggered when I send out a CAN message 
from an 
> external CAN node into the LPC. However, the first message I look 
at reads 
> all its registers as being filled with zeros. If I then send 
another CAN 
> message from the external CAN node, the data and the identifier are 
what was 
> send out by the remote node on the first transmission. The third 
message  
> reads the second message's data and identifier and so on. 
> 
> If I insert the line:
> 
> 	temp = CAN1RID;
> 
> into the routine above, just to prove it's not a different part of 
my code 
> that's at fault, the value in temp is always the identifier from 
the previous 
> CAN mesaage. 
> 
> Has anyone ever come across this before? I've read through the 
datasheet and 
> nothing seems to indicate why this would happen and I don't see 
anything in 
> the errata sheet either. I have checked with a little CAN analyser 
and the 
> messages being sent out from the external node seem correct. 
> 
> I've even tried reading the first message twice to see if I could 
flush out 
> the phantom zeros, but I just read zeros again. It's only when I 
receive the 
> second CAN message that the first message is flushed out. 
> 
> Anyone seen anything like this before? And if so, do you know what 
I'm doing 
> wrong?!
> 
> Many thanks.
> 
> Rob.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.