ECIO40P16 and Internal CAN truble
Moderator: Benj
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
ECIO40P16 and Internal CAN truble
Hi, I need some help, I can not communicate with a TJA 1050 CAN Controller with internal CAN1 and CAN2
I'm used to using Arduino and external SPI module and it worked well but I want to try an ECIO40P16 because it has 2 Internal ECAN.
I use the CAN (Internal, MCP2515) component in Flowcode 7
CAN1 TX ReMap to D0
CAN1 RX ReMap to B9
CAN2 TX ReMap to D6
CAN2 RX ReMap to D7
What are i doing wrong? Is there anything about RE Map I'm doing wrong? after what I understand, there is no port specifically dedicated to CAN or is it?
Hardware is:
1 ECIO40P16
2 TJA 1050 CAN Controller (Both of them are tested and work properly) https://www.ebay.com/itm/10PCS-TJA1050- ... 2749.l2649
Thanks
I'm used to using Arduino and external SPI module and it worked well but I want to try an ECIO40P16 because it has 2 Internal ECAN.
I use the CAN (Internal, MCP2515) component in Flowcode 7
CAN1 TX ReMap to D0
CAN1 RX ReMap to B9
CAN2 TX ReMap to D6
CAN2 RX ReMap to D7
What are i doing wrong? Is there anything about RE Map I'm doing wrong? after what I understand, there is no port specifically dedicated to CAN or is it?
Hardware is:
1 ECIO40P16
2 TJA 1050 CAN Controller (Both of them are tested and work properly) https://www.ebay.com/itm/10PCS-TJA1050- ... 2749.l2649
Thanks
- Attachments
-
- ECIO40P16_CAN_Test.fcfx
- (20.64 KiB) Downloaded 319 times
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
I found this but do not know if it is the same.
But could anyone explain this a little better. What file and what should I change? I need to go Bus Rate 500
But could anyone explain this a little better. What file and what should I change? I need to go Bus Rate 500
Jay Dee wrote:Hi,
Same as with FC6, Using standard setting the CAN transmits at half the required speed.
To make it work on the bench I changed Register CxCTRL1 from 0x0800 to 0x0000
bit 11 = 0 //FCAN is equal to Fp, Datasheet page 362.
This works for my setup running at 1Mbit, not checked anything else as yet.
Regards, J.
kersing wrote:The controller on the ECIO 40P16 has a silicon issue which reverses that particular bit. May-be a property can be introduced to allow users to determine activation of a work-around. (Hard coding would work as long as Microchip does not release fixed silicon)
See errata for devices affected.
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
I can confirm now this is the same problem as I have. But there is someone who can take the time to explain to me how I fix this
kennethnilsen69 wrote:I found this but do not know if it is the same.
But could anyone explain this a little better. What file and what should I change? I need to go Bus Rate 500
Jay Dee wrote:Hi,
Same as with FC6, Using standard setting the CAN transmits at half the required speed.
To make it work on the bench I changed Register CxCTRL1 from 0x0800 to 0x0000
bit 11 = 0 //FCAN is equal to Fp, Datasheet page 362.
This works for my setup running at 1Mbit, not checked anything else as yet.
Regards, J.kersing wrote:The controller on the ECIO 40P16 has a silicon issue which reverses that particular bit. May-be a property can be introduced to allow users to determine activation of a work-around. (Hard coding would work as long as Microchip does not release fixed silicon)
See errata for devices affected.
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
another problem:
When I set component can1 (internal-1) bus rate to 1000 it works ok on bus rate 500.
but when i add can2 (internal-2) bus rate 1000, bus2 does not work properly. Yes it seems that it works at 500 rate but gives out the wrong data (I get ID 0 and DLC 0 and no data)
When I switch the TX and RX bus like this:
from:
CAN1:
TX Remap D0
RX Dmap B8
CAN2
TX Remap D6
RX Remap D7
To:
CAN1:
TX Remap D6
RX Remap D7
CAN2
TX Remap D0
RX Remap B8
Then everything turns and now CAN2 works, but not CAN1.
Any ideas?
When I set component can1 (internal-1) bus rate to 1000 it works ok on bus rate 500.
but when i add can2 (internal-2) bus rate 1000, bus2 does not work properly. Yes it seems that it works at 500 rate but gives out the wrong data (I get ID 0 and DLC 0 and no data)
When I switch the TX and RX bus like this:
from:
CAN1:
TX Remap D0
RX Dmap B8
CAN2
TX Remap D6
RX Remap D7
To:
CAN1:
TX Remap D6
RX Remap D7
CAN2
TX Remap D0
RX Remap B8
Then everything turns and now CAN2 works, but not CAN1.
Any ideas?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO40P16 and Internal CAN truble
Hello,
Not sure why D6 and D7 would be causing issues? I'll see if I can spot anything in the device datasheet.
Just add this to your program inside a C icon after calling the CAN initialise macro.I can confirm now this is the same problem as I have. But there is someone who can take the time to explain to me how I fix this
Code: Select all
C1CTRL1 = 0x0000;
C2CTRL1 = 0x0000;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
Thank you benj the c command worked well
D7 and D6 work fine if I switch from CAN1 to CAN2 (Software only)
just me who writes and explains a little wrong. I try again
With this configuration, only CAN 1 works
CAN1: (internal-1)
TX Remap D0
RX Dmap B8
CAN2: (internal-2)
TX Remap D6
RX Remap D7
With this configuration, only CAN 1 works
CAN1: (internal-1)
TX Remap D6
RX Remap D7
CAN2 (internal-2)
TX Remap D0
RX Remap B8
component 2 does not work but the D7 and D6 work fine

It's not D7 and D6 that's the problem. It is CAN component.Benj wrote:Code: Select all
C1CTRL1 = 0x0000; C2CTRL1 = 0x0000;
D7 and D6 work fine if I switch from CAN1 to CAN2 (Software only)
just me who writes and explains a little wrong. I try again
With this configuration, only CAN 1 works
CAN1: (internal-1)
TX Remap D0
RX Dmap B8
CAN2: (internal-2)
TX Remap D6
RX Remap D7
With this configuration, only CAN 1 works
CAN1: (internal-1)
TX Remap D6
RX Remap D7
CAN2 (internal-2)
TX Remap D0
RX Remap B8
component 2 does not work but the D7 and D6 work fine
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
More testing shows that it is Internal 2 that is not working.
If I only switch on Internal 1 and 2 from CAN1 and CAN2 then it's always internal 2 that does not work
If I only switch on Internal 1 and 2 from CAN1 and CAN2 then it's always internal 2 that does not work
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
There is also another problem:
If I initialise CAN2, SetTxIdent and SetTxData do not work on CAN1
If I initialise CAN2, SetTxIdent and SetTxData do not work on CAN1
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO40P16 and Internal CAN truble
Hello,
Please can you confirm you are using FLowcode v7.3 and have applied the fixes from here.
viewtopic.php?f=63&t=19743#p86234
There are some CAN related fixes in there.
I'm just combing through the internal CAL code now to see if I can spot any problems.
Please can you confirm you are using FLowcode v7.3 and have applied the fixes from here.
viewtopic.php?f=63&t=19743#p86234
There are some CAN related fixes in there.
I'm just combing through the internal CAL code now to see if I can spot any problems.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO40P16 and Internal CAN truble
Hello,
I believe I may have now fixed the problem. In the initialisation of the DMA the channel 2 pointers were referring to the channel 1 pins. Hopefully should all be resolved for you now.
Please copy the attached file into your "Flowcode 7/CAL/PIC16BIT" folder and let us know how you get on.
The same problem exists in v8 so I'll get it fixed there too.
I believe I may have now fixed the problem. In the initialisation of the DMA the channel 2 pointers were referring to the channel 1 pins. Hopefully should all be resolved for you now.
Please copy the attached file into your "Flowcode 7/CAL/PIC16BIT" folder and let us know how you get on.
The same problem exists in v8 so I'll get it fixed there too.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
Yes, I use Flowcode v7.3 with the fixBenj wrote:Hello,
Please can you confirm you are using FLowcode v7.3 and have applied the fixes from here.
viewtopic.php?f=63&t=19743#p86234
There are some CAN related fixes in there.
I'm just combing through the internal CAL code now to see if I can spot any problems.

-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
This fixes the problem of the initialisation but still incorrect on CAN2 on first attempt after a power start, it sends out on CAN2 "ID 1 DLC 4 Data 04 00 04 00" instead of ID 100 DLC 8 Data 02 02 02 02 02 02 02 02Benj wrote:Hello,
I believe I may have now fixed the problem. In the initialisation of the DMA the channel 2 pointers were referring to the channel 1 pins. Hopefully should all be resolved for you now.
Please copy the attached file into your "Flowcode 7/CAL/PIC16BIT" folder and let us know how you get on.
PIC16BIT_CAL_CAN.c
The same problem exists in v8 so I'll get it fixed there too.
and after the first, it always sends out "ID 80 DLC 2 Remote Frame (DLC=2)" instead of ID 100 DLC 8 Data 02 02 02 02 02 02 02 02
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
Re: ECIO40P16 and Internal CAN truble
And if I swap around Internal 1 and 2 i get this (only software swap)
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO40P16 and Internal CAN truble
Hello,
Many thanks for letting me know so fast. I've had another comb through and think I've found some more problems that have now been fixed. These have gotten rid of some compiler warnings so I am hopeful we are closer now.
Have a go and let us know how you get on.
Many thanks for letting me know so fast. I've had another comb through and think I've found some more problems that have now been fixed. These have gotten rid of some compiler warnings so I am hopeful we are closer now.
Have a go and let us know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 101
- Joined: Tue Sep 01, 2015 9:37 pm
- Been thanked: 14 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO40P16 and Internal CAN truble
Thanks, I'll see if I can get it rigged up here to do a more thorough test for lurking CH2 bugs.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel