MCP2515 CAN Data loss

Hi there ,
I am using MCP2515 based CAN IOT card . It was observed that there is a data loss if I try to send 10 DATA frames with different ID’s with a delay of 10ms . It was observed that out of 10 only 6-7 Data are received where as if i try to send only 4 Data Frames with 10ms of delay i don’t see any Data loss .

Note : Peak CAN is the master device which will send the CAN data and WP7608(MCP2515) is the slave device which will receive the CAN data . (CAN dump is used to receive CAN data )

Basically the SPI driver is not reading the messages from mcp2515 chip fast enough and it was observed that IRQ thread irq/259-mcp251x priority is 50 which is lower (That means the IRQ-Handler can be served or might not be served at the exact time of interrupt) . Is there a way to overcome this issue ? Is it possible to change the rtprio of the irq/259-mcp251x ?

Thanks & Regards

Akshay

How about setting the task priority of the driver to a value larger than 50?
e.g.


struct sched_param PARAM = {.sched_priority = MAX_RT_PRIO };

PARAM.sched_priority = 51;

sched_setscheduler(task, SCHED_FIFO, &PARAM);


Another way is to use local_irq_disable() and local_irq_enable() to stop the interrupt from other priority when driver trying to read the data.