Page 1 of 2

dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS [solved]

Posted: Mon Mar 05, 2018 5:16 pm
by celebriums
Hi Benj

When I send canbus with dsPIC33EP128MC506 and dsPIC33EP32MC502, I saw wrong values on the CANBUS analyzer. When I want to read the CANBUS data, I cannot read. I chose CANBUS component from TOOLS Menu.


With dsPIC33EP256MU806 only when SJW=4 and Sample=%80, I can read.

All of softwares at attachment.

Help Me Please.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Fri Mar 16, 2018 5:59 pm
by Benj
Hello Sadik,

Have you confirmed that your micro is running at the speed you think it is by doing a 1 second flasher test?
https://www.matrixtsl.com/wikiv7/index. ... ED_flasher

If the flasher test looks ok then can you tell us what values you are trying to send and the corresponding value the analyser is reading back.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Mar 27, 2018 7:05 pm
by QMESAR
Benj wrote: Have you confirmed that your micro is running at the speed you think it is by doing a 1 second flasher test?
Hi
I can only agree with what Ben is saying ,I looked at your FC charts and I see many configuration settings missing ,
In my opinion you should have a C function call in which you configure the mcu clock settings correctly as the build in menu only allows for
the PLL and the Clock source to be set however you need to set the indicated values in the attached in a C function call
1.JPG
1.JPG (40.95 KiB) Viewed 14385 times

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Wed Mar 28, 2018 9:13 pm
by celebriums
Hello Qmesar

Thank you for your interest.

The problem is the following; dsPIC33EP256MU806 (70Mhz OSC.) Can read CANBUS data, but can not send it?
DsPIC33EP128MC502 (20Mhz Basic OSC) CAN be able to send CANBUS data but can not read it.
In the DSPIC33EP128MC506 (70 Mhz OSC), the values ​​change, starting to send meaningless values.
I'm surprised :) I will write again in more detail tomorrow.

How can I make the correct PLL settings for the DSPIC33EP series PLL? I have a 70MHz oscillator.

Thank you in advance for your help.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Wed Mar 28, 2018 9:27 pm
by celebriums
Benj wrote:Hello Sadik,

Have you confirmed that your micro is running at the speed you think it is by doing a 1 second flasher test?
https://www.matrixtsl.com/wikiv7/index. ... ED_flasher

If the flasher test looks ok then can you tell us what values you are trying to send and the corresponding value the analyser is reading back.
Thank you Benj, I will share the results of CANBUS ANALYZER tomorrow again.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Wed Mar 28, 2018 10:56 pm
by kersing
Have you checked the errata for this device? When working with one of the dsPIC33EP family devices and CAN a few years back I found there was a silicon error requiring a bit to be set to the opposite value of what the datasheet mentioned.

A quick check of the errata shows there are at least two CAN related issues in some of the silicon revisions of the dsPIC33EP128MC506.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Wed Mar 28, 2018 11:19 pm
by celebriums
Thank you for your interest Kersing,
I agree with you that the core of MCUs are the same, dsPIC33EP256MU806 is more stable than the others, dsPIC33EP128MC506 and 206 are not stable. For this reason I tested different speeds.
The result is unfortunate frustration :D

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Apr 03, 2018 11:30 am
by celebriums
Hello Everyone,
I have done with the DSPIC33EP128MC506, CANBUS communication problems, as follows. DATA02, DATA3, DATA4, DATA5, DATA6, DATA7 can not send the desired value.
OSC: EXT 70 Mhz, 1 second LED test is working correctly.

1. When sending CANBUS data, CAN ANALYZER results are as follows;

ID = 0x12FE1241 Correct (read data 0x12FE1241)
Buffer = 0
DLC = 8 Correct (read data = 8 )

DATA0 = 0x00 Correct (read data 0x00)
DATA1 = 0x00 Correct (read data 0x00)
DATA2 = 0x00 Incorrect (read data 0xFD)
DATA3 = 0x00 Incorrect (read data 0x12)
DATA4 = 0x00 Incorrect (read data 0x49)
DATA5 = 0x00 Incorrect (read data 0x08)
DATA6 = 0x00 Incorrect (read data 0x08)
DATA7 = 0x00 Incorrect (read data 0x04)

ID = 0x12FE1242 Correct (read data 0x12FE1242)
Buffer = 1
DLC = 8 Correct (read data = 8 )

DATA0 = 0x00 Correct, (read data 0x00)
DATA1 = 0x00 Correct, (read data 0x00)
DATA2 = 0x00 Incorrect, (read data 0xFD)
DATA3 = 0x00 Incorrect, (read data 0x12)
DATA4 = 0x00 Incorrect, (read data 0x49)
DATA5 = 0x00 Incorrect, (read data 0x08)
DATA6 = 0x00 Incorrect, (read data 0x08)
DATA7 = 0x00 Incorrect, (read data 0x08)


What can I do in this situation?

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Apr 03, 2018 2:10 pm
by LeighM
Hi,
I think the bit rate might be slightly out.
Could you try this code in a C icon immediately following the CAN:Init call ...

Code: Select all

C1CTRL1bits.REQOP = REQOP_CONFIG;
while( C1CTRL1bits.OPMODE != REQOP_CONFIG);
C1CFG2 = 0x06DA;
C1CTRL1bits.REQOP = 0;
while(C1CTRL1bits.OPMODE != 0);

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Apr 03, 2018 2:32 pm
by celebriums
Hi,
I made the difference as well, but in this case CANBUS does not send data. Is the location of the C code correct?

C1CTRL1bits.REQOP = REQOP_CONFIG; /* Set the ECAN module for Configuration Mode before writing into the Baud
Rate Control Registers*/
while( C1CTRL1bits.OPMODE != REQOP_CONFIG);
C1CFG2 = 0x06DA;
C1CTRL1bits.REQOP = 0; "/* Put the ECAN Module into Normal Mode Operating Mode*/"
while(C1CTRL1bits.OPMODE != 0); /* Wait for the ECAN module to enter into Normal Operating Mode */

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Apr 03, 2018 3:46 pm
by LeighM
Yes, looks OK.
Maybe remove all C icon code except ...

Code: Select all

C1CFG2 = 0x06DA;

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Apr 03, 2018 4:21 pm
by celebriums
LeighM

I think I found the problem and it's very interesting. The codes you wrote do not work.

SetTxData into the macro; CanData0, CanData1, variables are defined, and Flowcode do not mind, writing them for D0 and D1.

but

SetTxData into the macro; CanData2, CanData3, CanData4, CanData5, CanData6 and CanData7, variables are defined, and Flowcode do mind, writing them for D2,D3,D4,D5,D6 and D7.

When I delete the variables CanData0,1,2,3,4,5,6,7 the wrong files are recovering and working normally.

It is necessary to define variables in SetTxData. What can I do in this situation?

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Tue Apr 03, 2018 5:22 pm
by celebriums
LeighM

There is another problem.
The ID value of the data from the CAN line; 0x12fe1240.
I read the CAN ID value and send it back to the CAN line. I check the accuracy of the CAN ID value.

but


I'm reading the wrong ID 0xBF1240 instead of 0x12FE1240.

I think there is also a problem with the GetRxData function.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Wed Apr 04, 2018 11:06 am
by LeighM
Hi,
I've found some issues with the ID, please try attached updated file (to go in Flowcode \CAL\PIC16BIT directory)
I cannot yet see what the problem might be with the data buffer.
Just to confirm... transmitted data 0 and data 1 are seen as OK with the analyzer, but not OK with 2 to 7?

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Wed Apr 04, 2018 3:10 pm
by celebriums
Hi
I installed the PIC16BIT_CAL_CAN.c file, Flowcode \ CAL \ PIC16BIT.
. 0x1240 instead of 0x12FE1240. Unfortunately the code did not happen this time

I have another problem; Any new variable attachments can not send CAN data. Please watch the video.
https://youtu.be/aSsWfAiEVOw
https://youtu.be/vuNjZmqrj6Y

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Thu Apr 05, 2018 12:23 pm
by LeighM
Hi,
Thanks, but it is difficult to work out what is happening with the videos.
Do you have two dsPIC boards connected via CAN?
Would it be possible to just have one board transmit a message with a delay, and check first that transmit is OK with the analyser?

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Thu Apr 05, 2018 1:19 pm
by celebriums
.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Thu Apr 05, 2018 1:20 pm
by celebriums
Hi
Yes, there are two devices connected via CAN. The 0x12FE1240 data belongs to a CANBUS device running correctly.

(0x1240) signal is the CANBUS signals of dsPIC33EP128MC506.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Thu Apr 05, 2018 2:17 pm
by LeighM
Hi,
Is the correctly running CAN the dsPIC33EP256MU806?

As I have just created a test on hardware and have an MU806 transmitting correctly, although the bit rate is half what it should be,
I think that is possibly the silicon error that Kersing mentioned, but I've yet to check the errata datasheet.

So, the dsPIC33EP128MC506, is that transmitting OK, or not, or receiving OK or not?

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Thu Apr 05, 2018 2:55 pm
by celebriums
The correct running dsPIC33EP128MC506 is the software for this product. (dsPIC33EP128mc506Remote). It can only send the right value.

As far as I understand; Silicon is not the fault, ( I'm sure about this )

As far as I understand; When I add a new variable,dsPIC33EP128MC506 can not read the data.

"So, the dsPIC33EP128MC506, is that transmitting OK, or not, or receiving OK or not?" I'll try it quickly and write the results soon.

Please consider dspic33EP128MC506Remote (trueversion). sorry

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Thu Apr 05, 2018 3:57 pm
by celebriums
The dsPIC33EP128MC506, is that transmitting not OK.
Please watch this first mistake
videos link.
https://youtu.be/l0jE6yVKz_E

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Fri Apr 06, 2018 8:48 am
by LeighM
Hi,
Thanks for doing that simple transmit test.
Do you have an oscilloscope to test the bit rate on the CAN bus? And also check both signals (+/-) are OK on the CAN bus?
Could you also try the code addition after the CAN:init and see what difference that makes? ...

Code: Select all

C1CFG2 = 0x06DA;

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Fri Apr 06, 2018 10:06 am
by celebriums
After adding C code; I have studied with Microchip CANBUS Analyzer, SALEAE Logic Analyzer, and Osilaskop, there is no slight change.

I can understand that there is, no hardware problem when dsPIC33EP128MC506TrueVersion is installed.

PCBs made in two different hardware in the hand give the same result. (CANBUS cabling in the form of a twist.)

Could you please check the link of the dsPIC33EP128MC506TrueVersion videos showing that it works correctly after installing the software?

Please watced video https://youtu.be/ohFD7m-CYYE

dsPIC33EP128MC506TrueVersion data sent by (CAN ID: 0x18FE1240)
dsPIC33EP128MC506_Only_Send data sent by (CAN ID: 0x12FE1200)

Notes:
Data sent by the other device(tester remote hardware have a dsPIC33EP128MC506TrueVersion software) on the line: (CAN ID 0x12FE1240)

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Fri Apr 06, 2018 10:48 am
by LeighM
So, just to confirm...
In the video, the "MC506 Only Send" is the only device sending on the CAN bus?
The analyser is catching two messages:
0x12FE1200 with the first two bytes correct (1,2), but the other 6 bytes incorrect
0x12FE1240 with wrong data (not 1,2,3,4,5,6,7,8)
Are both these messages coming from the MC506?
Does the analyser detect invalid messages?

It is very strange as the code works on my MU806 and I cannot yet see any differences between the devices in the datasheets.

Re: dsPIC33EP128MC506, dsPIC33EP32MC502 and dsPIC33EP256MU806 CANBUS problem

Posted: Fri Apr 06, 2018 12:18 pm
by celebriums
Hi LeighM,
There are just two devices on the CAN line. Each of them use dsPIC33EP128MC506.
The data of 0x12FE1240 is on the line continously and it doesn't send wrong data anyways.
0x12FE1240 with correct data (0,0,0,0,1,1,0,0). I never change this software, I just observe the CANBUS line.

The software at the beginning of the video is the software we have added the C code.

Step 1) 0x12FE1200 with the first two bytes correct (1,2), but the other 6 bytes incorrect (Correct) (Software: dsPIC33EP128MC506Send_Only)

Step 2) The second software that I have compiled at the video is dsPIC33EP128MC506TrueVersion. This software sends correct data.
It's CAN ID is 0x18FE1240.

I will incorporate the device which contain 806MCU and I will try that.