elecLear78
Member
I am faced with some implementation confusion with regard to timing efficiency.
There are two core processors in single micro controller one core will be receiving peripheral CAN interrupts and the other will be processing these interrupt CAN data. Both will be running parallely
Method1:
Let us say in "x" time the number of interrupts received is "n" by one processor.
interrupt can_receive()
{
n++;
if(n == fixedvalue)
{
n =0;
}
}
The other will be processing these n messages like
main()
{
// some other functionality
copy n to local variable make n =0;
localvalue = n;
while(localvalue)
{
processMessages();
localvalue--;
}
}
Method2:
First processor
interrupt can_receive()
{
n++;
}
Second processor
main()
{
while(1)
{
// someother functionality
processMessage();
n--;
}
I have implemented the first method and the second method is something like Stack. My question is which is the better method in terms of timing. Few things are i do not know the time when the processMessages() will be executed in the sense by the time it executes n can be any number. And the data coming in the interrupt is stored in an array which i fixed to some value. if n exceeds this limit in the interrupt and by that time if it cannot be processed i make it "0" in the interrupt but i hope that the processMessage will be called before this.
i am not sure if i made my question clearly but please provide some advice. If require further information please let me know. The micro is s12x and the two cores are s12x and xgate.
Thanks in advance.
There are two core processors in single micro controller one core will be receiving peripheral CAN interrupts and the other will be processing these interrupt CAN data. Both will be running parallely
Method1:
Let us say in "x" time the number of interrupts received is "n" by one processor.
interrupt can_receive()
{
n++;
if(n == fixedvalue)
{
n =0;
}
}
The other will be processing these n messages like
main()
{
// some other functionality
copy n to local variable make n =0;
localvalue = n;
while(localvalue)
{
processMessages();
localvalue--;
}
}
Method2:
First processor
interrupt can_receive()
{
n++;
}
Second processor
main()
{
while(1)
{
// someother functionality
processMessage();
n--;
}
I have implemented the first method and the second method is something like Stack. My question is which is the better method in terms of timing. Few things are i do not know the time when the processMessages() will be executed in the sense by the time it executes n can be any number. And the data coming in the interrupt is stored in an array which i fixed to some value. if n exceeds this limit in the interrupt and by that time if it cannot be processed i make it "0" in the interrupt but i hope that the processMessage will be called before this.
i am not sure if i made my question clearly but please provide some advice. If require further information please let me know. The micro is s12x and the two cores are s12x and xgate.
Thanks in advance.