# MCP2515 CAN Data loss

**URL:** <https://forum.legato.io/t/mcp2515-can-data-loss/4928>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [January 3, 2020, 11:17am UTC](https://forum.legato.io/t/mcp2515-can-data-loss/4928 "2020-01-03T11:17:20Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 31, 2020, 2:40pm UTC](https://forum.legato.io/t/mcp2515-can-data-loss/4928/7 "2020-08-31T14:40:19Z")

</div>

Seems you did not change the task priority…

Attached “priority\_test.rar” is my testing code.  
In low\_priority\_helloworld.c, I have set the task priority to be 51.  
In high\_priority\_helloworld.c, I have set the task priority to be 50 which is having lower priority than the other one.

If you run the two kernel drivers together, you can check by:

* * *

root@fx30:~# ps -eo pid,pri,rtprio,cmd | grep LED  
4755 91 51 [LED\_flash\_threa]  
4786 90 50 [LED\_flash\_threa]  
5613 19 - grep LED

* * *

I can set the task priority!

Moreover, the high\_priority\_helloworld printing (dmesg | grep priority) will never be interrupted by another one. It is because I have added the code “local\_irq\_disable” and “local\_irq\_enable”.  
If I comment out the code “local\_irq\_disable” and “local\_irq\_enable” in high\_priority\_helloworld.c, the high\_priority\_helloworld printing (dmesg | grep priority) will be interrupted by another one.

I think this can show “local\_irq\_disable” and “local\_irq\_enable” are actually working fine to block another task with high priority to interrupt own task.

[priority\_test.rar](https://forum.legato.io/uploads/short-url/z650p2IobDZdikaf2sudhdgEUBQ.rar) (169.7 KB)

---

_[View the full topic](https://forum.legato.io/t/mcp2515-can-data-loss/4928)._
