dsPIC33EP512GM710 CAN bus stopped working

An area to discuss 16-bit PIC specific problems and examples

Moderator: Benj

lexicon
Flowcode v5 User
Posts: 55
Joined: Mon Apr 06, 2015 6:30 pm
Has thanked: 20 times
Been thanked: 22 times
Contact:

Re: dsPIC33EP512GM710 CAN bus stopped working

Post by lexicon »

A few more experiments with variable definitions resulted in more variations on the output:

5x int = 08 00 FC 1F FC 1F 08 00
6x = 00 00 FC 1F 00 00 FC 1F
7x = FC 1F FC 1F FC 1F FC 1F

And then with 8 int's defined... it worked correctly.
ETA: It seems like the pattern probably repeats then as 9 is the same as 1.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: dsPIC33EP512GM710 CAN bus stopped working

Post by LeighM »

Hi Martin,
Thanks for the investigations.
Looks then like it might be worth trying the (original) version of PIC16BIT_CAL_CAN.c that has the aligned attribute setting with that latest compiler
Thanks
Leigh

lexicon
Flowcode v5 User
Posts: 55
Joined: Mon Apr 06, 2015 6:30 pm
Has thanked: 20 times
Been thanked: 22 times
Contact:

Re: dsPIC33EP512GM710 CAN bus stopped working

Post by lexicon »

Due to a period of stupidity on my part, I was wrong to say that the device no longer resets with certain PIC16BIT_CAL_CAN.c files - it does, just the same :oops:
Anyway, I have tried all 8 versions that I have, but I still get the same results - the ones that do not cause a reset have the corrupted output dependent on the variable definitions.

Martin.

lexicon
Flowcode v5 User
Posts: 55
Joined: Mon Apr 06, 2015 6:30 pm
Has thanked: 20 times
Been thanked: 22 times
Contact:

Re: dsPIC33EP512GM710 CAN bus stopped working

Post by lexicon »

Having continued to struggle, but needing a solution, I decided to have a go at driving the CAN bus in MPLABX using the device configurator (MCC).
I was able to fairly easily create code to transmit CAN messages.

I have since been able to 'merge' the Flowcode .c code with the MCC generated files and build a working hex file in MPLAB.

This is a bit of a 'hack & bodge' workaround, and may not be viable for a complex project, but it's a start.

Post Reply