Page 1 of 1

CAN interrupt (external CAN) for the ECIO40P16

Posted: Sat Sep 12, 2020 5:53 pm
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

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Fri Sep 18, 2020 12:26 pm
by tiny
Nobody here who could help me a little?

Christina

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Fri Sep 18, 2020 3:06 pm
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 3892 times
P2.jpg
P2.jpg (53.49 KiB) Viewed 3892 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

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Fri Sep 18, 2020 10:45 pm
by tiny
Thanks for the answer, I'll take a look.
Christina

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Sun Sep 20, 2020 9:18 am
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

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Sun Sep 20, 2020 10:35 pm
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

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Thu Sep 24, 2020 5:32 pm
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

Re: CAN interrupt (external CAN) for the ECIO40P16

Posted: Thu Sep 24, 2020 10:57 pm
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