Page 1 of 1

ECIO40P16 and Internal CAN truble

Posted: Sun Aug 26, 2018 9:44 pm
by kennethnilsen69
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

Re: ECIO40P16 and Internal CAN truble

Posted: Sun Aug 26, 2018 10:32 pm
by kennethnilsen69
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.

Re: ECIO40P16 and Internal CAN truble

Posted: Mon Aug 27, 2018 2:47 pm
by kennethnilsen69
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.

Re: ECIO40P16 and Internal CAN truble

Posted: Tue Aug 28, 2018 8:50 am
by kennethnilsen69
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?

Re: ECIO40P16 and Internal CAN truble

Posted: Tue Aug 28, 2018 10:39 am
by Benj
Hello,
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
Just add this to your program inside a C icon after calling the CAN initialise macro.

Code: Select all

C1CTRL1 = 0x0000;
C2CTRL1 = 0x0000;
Not sure why D6 and D7 would be causing issues? I'll see if I can spot anything in the device datasheet.

Re: ECIO40P16 and Internal CAN truble

Posted: Tue Aug 28, 2018 11:53 am
by kennethnilsen69
Thank you benj the c command worked well :-)
Benj wrote:

Code: Select all

C1CTRL1 = 0x0000;
C2CTRL1 = 0x0000;
It's not D7 and D6 that's the problem. It is CAN component.
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

Re: ECIO40P16 and Internal CAN truble

Posted: Tue Aug 28, 2018 11:59 am
by kennethnilsen69
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

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Aug 30, 2018 1:18 pm
by kennethnilsen69
Hi Benj, have you had time to look at it?

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Sep 06, 2018 2:27 pm
by kennethnilsen69
There is also another problem:
If I initialise CAN2, SetTxIdent and SetTxData do not work on CAN1

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Sep 06, 2018 3:09 pm
by Benj
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.

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Sep 06, 2018 3:27 pm
by Benj
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
(68.34 KiB) Downloaded 245 times
The same problem exists in v8 so I'll get it fixed there too.

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Sep 06, 2018 9:35 pm
by kennethnilsen69
Benj 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.
Yes, I use Flowcode v7.3 with the fix :-) (v7.3.0.7)

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Sep 06, 2018 9:58 pm
by kennethnilsen69
Benj 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.
This fixes the problem of the initialisation but still incorrect on CAN2
CAN1AndCAN2.JPG
CAN1AndCAN2.JPG (49.67 KiB) Viewed 8691 times
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 02

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
ECIO40P16_CAN_BT_And_eeprom_Test.fcfx
(33.53 KiB) Downloaded 242 times

Re: ECIO40P16 and Internal CAN truble

Posted: Thu Sep 06, 2018 10:14 pm
by kennethnilsen69
And if I swap around Internal 1 and 2 i get this (only software swap)
CAN1AndCAN2 Internal1 and 2 Swap.JPG
CAN1AndCAN2 Internal1 and 2 Swap.JPG (44.49 KiB) Viewed 8690 times
ECIO40P16_CAN_BT_And_eeprom_Test.fcfx
(33.53 KiB) Downloaded 267 times

Re: ECIO40P16 and Internal CAN truble

Posted: Fri Sep 07, 2018 10:07 am
by Benj
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.
PIC16BIT_CAL_CAN.c
(66.65 KiB) Downloaded 157 times

Re: ECIO40P16 and Internal CAN truble

Posted: Fri Sep 07, 2018 10:41 am
by kennethnilsen69
Sorry Benj but no difference with the latest update

Re: ECIO40P16 and Internal CAN truble

Posted: Fri Sep 07, 2018 4:06 pm
by Benj
Thanks, I'll see if I can get it rigged up here to do a more thorough test for lurking CH2 bugs.