CAN interrupt (external CAN) for the ECIO40P16

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

CAN interrupt (external CAN) for the ECIO40P16

Post by tiny »

Hi Guys,

I need a CAN interrupt (external CAN) for the ECIO40P16 or a suggestion on how to create a user-defined interrupt. Can someone help me out there?

Thanks!
Christina

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: CAN interrupt (external CAN) for the ECIO40P16

Post by tiny »

Nobody here who could help me a little?

Christina

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: CAN interrupt (external CAN) for the ECIO40P16

Post by QMESAR »

Hi.
The MCP2515 has 2 Pins that can beset to Go low when the buffer has valid data and high when the buffer is empty
RX0BF and RX1BF ,what you need to do is
  • Connect these to pins to the ECIO40P16 IOC pins (Interrupt on change pins)
    Configure from Flowcode Interupt Icon the 2 IOC interupts
    Set the correcsponding registers in the MCP2515 to activate the RX0BF and RX1BF pins (see datasheet) you can do a SPI write to these registers by a C icon how it will function is when the IOC Interrupt pins on the MCU trigger an interrupt you know which buffer has a message and then read that buffer
P1.jpg
P1.jpg (34.27 KiB) Viewed 3150 times
P2.jpg
P2.jpg (53.49 KiB) Viewed 3150 times
The issue with the FC CAN Components is that it does not support these Interrupt settings and Error handling of the MCP2515
You will have to use the Datasheet and write C code to help you out unless MATRIX is willing to add this for you to the component

Hope this helps

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: CAN interrupt (external CAN) for the ECIO40P16

Post by tiny »

Thanks for the answer, I'll take a look.
Christina

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: CAN interrupt (external CAN) for the ECIO40P16

Post by QMESAR »

An alternative would be to connect the MCP2515 INT pin to one IOC pin then you trigger a interrupt with the IOC pin and check both buffers , read the one that has a message.This option you do not need any C code written to the 2515 as the INT pin alweays toggle on and message received ,just configure the IOC Interrupt in FC and use the CAN component to read the buffers

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: CAN interrupt (external CAN) for the ECIO40P16

Post by tiny »

Thanks for the tip, that's how I imagined it would be.

I will also try the internal CAN in parallel, possibly with an custom interrupt, flags should be described in the description of the microcontroller.
I will also look in the FC forum to see if there is an example of a custom interrupt.

Regards
Christina

User avatar
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: CAN interrupt (external CAN) for the ECIO40P16

Post by Benj »

Hi Christina,

Some help on custom interrupts here.
https://www.matrixtsl.com/wiki/index.ph ... sPIC/PIC24

Let us know how you're getting on

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: CAN interrupt (external CAN) for the ECIO40P16

Post by tiny »

Thanks Ben, that's what I was looking for!
I've already picked out the appropriate registers, it will certainly work with this example.

Thanks again!
Christina

Post Reply