Yahoo Groups archive

Lpc2000

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

Thread

Philips LCP2129 CAN Transmit Interrupt

Philips LCP2129 CAN Transmit Interrupt

2004-07-10 by johnthomasedwardtimm

I am using Vectored Interrupts. I have enabled the CAN Transmit 
interrupt to notify me when a transmission was successful so that I 
can transmit another message out of my message buffer. Unfortunately, 
I cannot deassert the interrupt as the ISR continues to get called 
repeatedly. I have tried several things including reading the CANICR 
register, etc. The end of the interrupt routine does a VICVectAddr = 
0xffffffff; I am using the Keil IDE and GNU/CC Compiler Tool Chain. 
None of the CAN examples use a transmit interrupt to send messages 
out of a buffer. I thought of a scheme that might where I 
enable/disable the interrupt, but there has to be a better way.   
Pseudocode looks something like this:

If a hardware transmit buffer is available
    Send message directly
else
    Add message to software buffer
end if

And then in the transmit interrupt routine:

while software buffer is not empty and there is a hardware buffer 
available
    get message from software buffer
    put message into a hardware buffer

VICVectAddr = 0xffffffff;  // Acknowledge Interrupt

If I test the code by sending one message, the routine sends it out 
and then the interrupt routine is called to signify that the 
transmission is complete.  However, simply executing the routine does 
not acknowledge the interrupt and it gets called repeatedly.  Any 
ideas?

Thanks, 

JT

Re: Philips LCP2129 CAN Transmit Interrupt

2004-07-10 by johnthomasedwardtimm

As mentioned previously, I can of course modify the routine to do 
something like this:

// SendMsg routine
If Hardware Transmit Buffer Available (TBS1, TBS2, or TBS3) Then
    Put Message into a Hardware Buffer
    Transmission Request (CANCMR)
Else
    Put Message into a Software Buffer
    Enable Transmit Interrupt (CANIER)
End If

// Tx ISR
While Software Buffer Is Not Empty AND
    Hardware Transmit Buffer Is Available
    Get Message From Software Buffer
    Put Message Into Hardware Transmit Buffer
End While

If Software Buffer Is Empty
    Disable Transmit Interrupt (CANIER)
End If

VICVectAddr = 0xffffffff; // Acknowledge Interrupt

I don't like the idea of continuously enabling/disabling the Transmit 
Interrupt 
using CANIER.  There has to be a way to clear the interrupt request, 
although simply reading CANICR does NOT work and I don't see anything 
in the User's Manual that will do it.

Thanks,

JT

> Pseudocode looks something like this:
> 
> If a hardware transmit buffer is available
>     Send message directly
> else
>     Add message to software buffer
> end if
> 
> And then in the transmit interrupt routine:
> 
> while software buffer is not empty and there is a hardware buffer 
> available
>     get message from software buffer
>     put message into a hardware buffer
> 
> VICVectAddr = 0xffffffff;  // Acknowledge Interrupt
> 
> If I test the code by sending one message, the routine sends it out 
> and then the interrupt routine is called to signify that the 
> transmission is complete.  However, simply executing the routine 
does 
Show quoted textHide quoted text
> not acknowledge the interrupt and it gets called repeatedly.  Any 
> ideas?
> 
> Thanks, 
> 
> JT

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.