Yahoo Groups archive

Lpc2000

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

Thread

CAN DOIE

CAN DOIE

2005-09-15 by albin_martinsson

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
}

RE: [lpc2000] Re: CAN DOIE

2005-10-06 by Gromann, Klaus

Hi Fredrik, 

sorry for that late answer but I was'nt in my office for the last weeks.

I have 3 members talking at the CAN bus and the load is about 40 % worst case (I sometimes do file download over the CAN-Bus) and 10% normal load.

I'm using the CTL-lib (It's a part of the CrossStudio from Rowley) as OS-base.

Do you have solved the problems or is it still the same ?

I got the data overrun only when I reboot the LPC (but that's clear because the CAN bus is still sending while the LPC is initialising again).

brgds

Klaus
Show quoted textHide quoted text
-----Original Message-----
From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On Behalf Of albin_martinsson
Sent: Friday, September 16, 2005 1:04 PM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Re: CAN DOIE



	Hi Klaus,
	
	The thing is that I really dont know if the IRQ is disabled for a 
	longer time, im using the freeRTOS port for LPC2129 so. If anyone 
	here knows, your can pleas tell me, or I will start to have a look 
	inside the code for the freeRTOS.
	
	BTW Klaus, in your system, how many systems are talking on the same 
	bus? Im using 3 units talking and the Bus Load not greater than 20-
	30%. 
	
	B.R 
	/Fredrik
	
	
	--- In lpc2000@yahoogroups.com, "Gromann, Klaus" 
	<klaus.gromann@r...> wrote:
	> Hi Frederik,
	> 
	> sorry, I've overseen the line with the request. So this cannot be 
	the problem.
	> Is it possible that the IRQ is disabled for a longer time period ?
	> I use the CAN on LPC2294 now for about 8 weeks and got no problems.
	> 
	> brgds
	> Klaus
	> 
	> 
	> -----Ursprüngliche Nachricht-----
	> Von: lpc2000@yahoogroups.com im Auftrag von Gromann, Klaus 
	{GGRH~Graz}
	> Gesendet: Do 15.09.2005 16:16
	> An: lpc2000@yahoogroups.com
	> Betreff: AW: [lpc2000] CAN DOIE
	>  
	> 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+mi
	crocontrollers&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_pqRTm8X
	q01nxwg>        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=TpkoX4KofDJ
	7c6LyBvUqVQ>        
	> 8051 microprocessor <http://groups.yahoo.com/gads?
	t=ms&k=8051+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=P
	ic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=1Ipf1Fjfbd_H
	VIlekkDP-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]
	> 
	> 
	> 
	> 
	> SPONSORED LINKS 
	> Microprocessor <http://groups.yahoo.com/gads?
	t=ms&k=Microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+mi
	crocontrollers&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_pqRTm8X
	q01nxwg>        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=TpkoX4KofDJ
	7c6LyBvUqVQ>        
	> 8051 microprocessor <http://groups.yahoo.com/gads?
	t=ms&k=8051+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=P
	ic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=1Ipf1Fjfbd_H
	VIlekkDP-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]
	
	
	
	
	
________________________________

	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]

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.