dsPIC33EP512MU810 ECAN TxRx Random Reset Issue

Beta Testing discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
seanreynolds
Posts: 2
Joined: 01 Sep 2018 09:49

dsPIC33EP512MU810 ECAN TxRx Random Reset Issue

#1 Post by seanreynolds » 01 Sep 2018 10:19

Hi all,
I am having a difficult time with the ECAN peripheral on a dsPIC33EP512MU810.

I have been using MikroElektronika for a long time & I am a big fan of their products and tools. Unfortunately, i am quite stuck on this issue and i am hoping that someone has encountered it before, or someone with more experience than myself may offer some useful debugging advice.

To summarise my problem: The dsPIC crashes with a software reset when trying to send AND receive standard CAN messages. My program is sending 3x 8-byte packets every 10ms, 3x 8 byte packets every 100ms and 2x 8-byte packets every 1s to individual addresses. These messages are sent from timer-based ISRs.The dsPIC is running at 48MIPS and the CAN baud rate is 500k. As soon as I add a receive function call to the CAN ISR, the processor resets immediately after power-on. Upon the reset, the CAN module appears to be disabled and no CAN messages are sent until a power cycle.

I have read through the ERRATA for this dsPIC and I took note of the DMA / CAN bus arbitration issue, to which i moved the TxRx DMA buffer to Dual Port Ram, and i set the receive dma priority to 7. This fixed my issue for about 1-480s - by this i mean, the processor will run as I expect it too, but will still soft-reset at completely random times between 1-480 seconds after power-on. I have a Vector CANalyzer for which i use to debug & verify CAN bus comms.

I have managed to get the system to somewhat behave by moving my CAN transmit functions to send after a RX message is received & processed - (this system receives 3 8-byte packets every 10ms). Unfortunately, if i perform any additional data processing or calculations after the RX message the dsPIC resets.

I have tried a combination of different timers, interrupt priorities and even removing interrupts completely and running my Tx & Rx comms entirely from the main function, which actually works ONLY with a 10ms delay between Rx and Tx processes. I have spent days attempting to rectify this issue, and i have thoroughly scoured both this & Microchip's forums. My current hypothesis is that there is a read / write collision, buffer or pointer overflow that occurs from the Tx & Rx comms. Using my Mikro debugger, I observed the following values in the C1 registers:

C1RXOVF1 : 0x01 80
C1CFG1 : 192
C1VEC : 264

I tried to catch the reset flags from the RCON register, but it never appeared to update and consistently displayed '0b1000 0011'.

I welcome any & all feedback, happy to provide more details incase i have missed anything - My first time posting, but I have been around these forums for a while, always very helpful. Thanks in advance.

Cheers :)
Last edited by seanreynolds on 04 Sep 2018 06:29, edited 1 time in total.

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: dsPIC33EP512MU810

#2 Post by petar.suknjaja » 03 Sep 2018 17:09

Hi,
I have seen some posts about ECAN and dsPIC33EP512MU810 so you can check them out.
Can you post the code here for review?
Kind regards,
Petar

seanreynolds
Posts: 2
Joined: 01 Sep 2018 09:49

Re: dsPIC33EP512MU810

#3 Post by seanreynolds » 04 Sep 2018 06:28

Hi,
Thank you for your reply. I have spent several days researching the problem I am having, and I have found many threads of similar issues without coming to a solution.

I have attached an entire project code, this is from one node I have running on a 500k CAN bus. The dsPIC33EP powers up, resets straight away, then runs correctly for a random length of time (<10minutes) before restarting. When it restarts, the CAN module is disabled and a power cycle is required for CAN communications to recommence.

I welcome any feedback & insights that could help me get past this one, its been driving me crazy..

Cheers
Attachments
MikroC_Project.zip
(77.96 KiB) Downloaded 133 times

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: dsPIC33EP512MU810 ECAN TxRx Random Reset Issue

#4 Post by petar.suknjaja » 06 Sep 2018 21:03

Hi,
I've send you the message and I'll continue to help you with your issue on helpdesk,
and when we finish it, you could share it here with rest of the forum.
In meanwhile I encourage everyone with similar issue/idea to post here.

Kind regards,
Petar

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 Beta Testing”