FreeRTOS & CAN

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
guyt123
Posts: 8
Joined: 10 Jul 2020 16:09

FreeRTOS & CAN

#1 Post by guyt123 » 11 Jun 2021 14:07

Hi,

I am using a PIC32MX575 device on a custom board which includes a CAN bus interface with mikroC PRO & FreeRTOS.
It had been working fine until I added a task to read from the CAN interface.

char _data[8];
unsigned int datalen, flags;
unsigned long id;
static void TestCANTask(void *params)
{


while(TRUE)
{
vTaskDelay(2);
/*deal with iso-tp stuff first*/
if (CAN1Read(&id, _data, &datalen, &flags) > 0)
{
//do something
asm nop;
}
}
}

This does work ok, I can put a breakpoint on the nop and it triggers correctly. However as soon as I restart the code it generates an exception at portISR_ENTRY() (from looking at EPC register). The same thing happens if I single step the code.
The cause register seems to indicate a data bus exception (0x1080041C)?

It's quite odd - any ideas? :)

Thanks,
Guy

Post Reply

Return to “mikroC PRO for PIC32 General”