Yahoo Groups archive

Lpc2000

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

Message

AW: [lpc2000] CAN DOIE

2005-09-15 by Gromann, Klaus

Hi Fredrik,

there are 2 things in your code that may cause problems :

1) You don't read the frame status register(CANRFS), so you loose the information if it is a 11-bit or a 29 bit identifier as well as the data length information and the remote request bit.

2) It is written in the comment but not done : release the buffer. To do this, you have to write 1 to bit2 in the command register (CANCMR)

brgds
Klaus

-----Ursprüngliche Nachricht-----
Von: lpc2000@yahoogroups.com im Auftrag von albin_martinsson
Gesendet: Do 15.09.2005 15:35
An: lpc2000@yahoogroups.com
Betreff: [lpc2000] CAN DOIE
 
Hello

Im using the CAN-interface in my application. 
My routine for CAN is interrupt-driven, here is an example of my ISR-
code:

I often get Data Overrun - error on the receive channel.
Anyone who has had the same problem? 
I also use the freeRTOS port for the LPC2129. 

B.R

Fredrik Martinsson, Sweden

void ISR_CANRX (void)
{
   tU32 *cBufdst;
   tU32 Buf[3];

   while (C1GSR&0x01) {
      // Save registers temp.
      Buf[0] = C1RID;
      Buf[1] = C1RDA;
      Buf[2] = C1RDB;
      C1CMR = 0x04;                               
      // release receive buffer
            
            
      if (++can_rxbufin>=CAN_QUEUESIZE)can_rxbufin = 0;
      cBufdst = &can_rxbuf[can_rxbufin].CmRID;
                  
      if (can_rxbufin == can_rxbufout) {
         if (++can_rxbufout>=CAN_QUEUESIZE)can_rxbufout = 0;
      }
      if (++can_rxbufsize>CAN_QUEUESIZE)
can_rxbufsize=CAN_QUEUESIZE;
                  
      *cBufdst = Buf[0];
      cBufdst++;
      *cBufdst = Buf[1];
      cBufdst++;
      *cBufdst = Buf[2];
                  
      // Give semaphore to start comTask
      xSemaphoreGiveFromISR( comSem, pdFALSE );
      }
      
   VICVectAddr = 0xFFFFFFFFL;                         
   // acknowledge Interrupt
}






SPONSORED LINKS 
Microprocessor <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=tsVC-J9hJ5qyXg0WPR0l6g>  	Microcontrollers <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=DvJVNqC_pqRTm8Xq01nxwg>  	Pic microcontrollers <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=TpkoX4KofDJ7c6LyBvUqVQ>  	
8051 microprocessor <http://groups.yahoo.com/gads?t=ms&k=8051+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=1Ipf1Fjfbd_HVIlekkDP-A>  	

________________________________

YAHOO! GROUPS LINKS 


	*	 Visit your group "lpc2000 <http://groups.yahoo.com/group/lpc2000> " on the web.
	  
*	 To unsubscribe from this group, send an email to:
	 lpc2000-unsubscribe@yahoogroups.com <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe> 
	  
*	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . 


________________________________




[Non-text portions of this message have been removed]

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.