Re: Using the CAN bus
Posted: Mon Mar 14, 2011 12:35 pm
Hi,
You can never call any pend functions in an interrupt, just post functions. You should not be using the interrupt serial driver from interrupts either since it is possible for it to pend on either a read or a write. A critical section in a task will not block an interrupt from occurring. You can not have a critical section in an interrupt. These OS objects can only be posted by the task that successfully pended it. Since an interrupt is not located in a task this will not work.
You should also not be calling any of the CAN functions from an interrupt, this is likely why you are having problems. Interrupts can only call very limited OS functions. You should only be calling post functions from an interrupt. You should probably set up another task fot sending your RTR messages. This task should be pending on a timer semaphore. In your timer interrupt you should just post to this semaphore which will let the send task run. This should be very similar to the semaphore example except you will post from the interrupt instead of another task:
C:\nburn\examples\RTOS\OSSemaphore
-Larry
You can never call any pend functions in an interrupt, just post functions. You should not be using the interrupt serial driver from interrupts either since it is possible for it to pend on either a read or a write. A critical section in a task will not block an interrupt from occurring. You can not have a critical section in an interrupt. These OS objects can only be posted by the task that successfully pended it. Since an interrupt is not located in a task this will not work.
You should also not be calling any of the CAN functions from an interrupt, this is likely why you are having problems. Interrupts can only call very limited OS functions. You should only be calling post functions from an interrupt. You should probably set up another task fot sending your RTR messages. This task should be pending on a timer semaphore. In your timer interrupt you should just post to this semaphore which will let the send task run. This should be very similar to the semaphore example except you will post from the interrupt instead of another task:
C:\nburn\examples\RTOS\OSSemaphore
-Larry