CAN (Internal, MCP2515) Problem/Bug

For general Flowcode discussion that does not belong in the other sections.
kennethnilsen69
Posts: 45
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 11:41 am
Been thanked: 3 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by kennethnilsen69 »

Thanks for the help so long. I understand that PIC16BIT_CAL_CAN.c is ok as you mentioned. But I don't understand this with interrupt and DMA.

To be able to send a can message out on can2 should be straight forward and work the same way as sending a can message out on can1. I'm not too concerned about what I can receive or how efficient I need to get can2 working first. When it works we can work on the efficiency and accuracy of it :-)

let's keep it very simple and get can2 to be able to send a message.

What's wrong with my test file since can2 doesn't work?

it's simple and straight forward, should work

I have this connected to a can bus that is monitored by canAnalyser software to see what happens when it tries to send ID 100 on can1 and ID 200 on can2

CAN1 works fine but CAN2 just gives an error on the bus and doesn't work
Attachments
CANTest1&2.fcfx
(17.9 KiB) Downloaded 24 times

BenR
Matrix Staff
Posts: 2223
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 613 times
Been thanked: 806 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by BenR »

Hello,

Your program all looks ok. The only key difference is can2 is half the speed of can1 which could potentially be causing the issues you're seeing with your analyser?

RGV250
Posts: 455
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 46 times
Been thanked: 46 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by RGV250 »

Hi,
I do not use FC for CAN but I always try it in "loopback" mode first to make sure there are no external influences.

If they are on the same BUS, where Ben pointed out they are different speeds I would expect CAN2 to set the error bit when CAN 1 is transmitting.

Have you tried CAN2 on its own?

Regards,
Bob

kennethnilsen69
Posts: 45
Joined: Wed Dec 02, 2020 11:41 am
Been thanked: 3 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by kennethnilsen69 »

BenR wrote:
Mon Jun 08, 2026 9:41 am
Hello,

Your program all looks ok. The only key difference is can2 is half the speed of can1 which could potentially be causing the issues you're seeing with your analyser?
CAN1 is set to 500 bus rate and can2 is set to 250 bus rate which is what they should be :-)

I am making a can device that will communicate with 2 can buses at the same time. I have a car that has 2 different can buses with different bus rates :-)

kennethnilsen69
Posts: 45
Joined: Wed Dec 02, 2020 11:41 am
Been thanked: 3 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by kennethnilsen69 »

This is the hardware I use. R3 and R4 are not used as this is connected to a bus that has 2 resistors in it.

I still can't get can2 to work.
Attachments
Schematic CAN module.jpg
Schematic CAN module.jpg (217.29 KiB) Viewed 172 times

RGV250
Posts: 455
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 46 times
Been thanked: 46 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by RGV250 »

Hi,
A couple of thoughts.
Have you tried to run CAN2 in loopback mode.
If you put it in listen only mode are there errors when connected to the BUS.
Have you looked at the error counters.
Have you tried on it's own to the analyser with an end of line at the analyser.

Regards,
Bob

kennethnilsen69
Posts: 45
Joined: Wed Dec 02, 2020 11:41 am
Been thanked: 3 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by kennethnilsen69 »

Image

thanks for the help everyone. The problem is solved and the problem was 2 defective 120 resistors on the 250 kbit/s bus. with new resistor it worked :-)

I will start a new thread about the use of interrupt on CAN RX and the advantages of this. I would like to learn a little more about this
Attachments
CAN1&CAN2_test.jpg
CAN1&CAN2_test.jpg (89.59 KiB) Viewed 138 times

Steve-Matrix
Matrix Staff
Posts: 1930
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 286 times
Been thanked: 448 times

Re: CAN (Internal, MCP2515) Problem/Bug

Post by Steve-Matrix »

Great news!

Post Reply