CAN CheckRx(0) Not working?

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

Moderator: Benj

Post Reply
Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

CAN CheckRx(0) Not working?

Post by Chris_MIRA »

Hi,
Im using an old programme (FC6 that used to work fine) in FC8. All works okay without change EXCEPT that the check for CAN message macro does not seem to return a 1 to indicate message received. I know the CAN buss is functioning as other systems are using it and messages are visible and as expected on the CAN tool I use (these messages include ones sent from the arduino MEGA Im using).
To check, I put together a simple test programme (included) and had the same result. Sent messages from the MEGA are fine but the macro (CheckRx) for checking for new messages (sent from my CAN tool) doesn't set "message" to 1 and therefore the next sent message does not change data... The programme steps through in simulation with no problem.
Am I doing something silly or is the macro broken in some way?
Regards,

Chris
Attachments
MEGA CAN Test 2.fcfx
(13.25 KiB) Downloaded 196 times

Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by Chris_MIRA »

After more testing , Im now sure this is a component macro bug and have reported it

Regards,
Chris

Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by Chris_MIRA »

Second test file attached, using different target (pic 16f1937) with ebloc 006 and ebloc CAN board. again messages viewed using can tool sugest hardware is okay but "checkRx" macro not working. How do I check to see if there is a reply to the bug report? Does anyone know of a fix or work-around for this please?

Regards,
Chris
Attachments
1937 CAN Test.fcfx
(11.96 KiB) Downloaded 178 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by LeighM »

Hi Chris,
Could you try setting the receive buffer to use "Mask and Filter" and set Mask and Filter to 0?
I notice that for your PIC project you have it set to Reject All.
Meanwhile I will have a further look into it.
Leigh

viktor_au
Posts: 342
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 44 times
Been thanked: 60 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by viktor_au »

Hi Chris

I am not sure if the CAN problem with Mega 2560 Rx is somehow connected to Modbus Mega 2560 Rx problem I reported in November 2018.
I have asked to update the situation but nobody from Matrix team have the time to answer.
Three months is passed... I cannot move forward with my project.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by LeighM »

Hi,
Sorry if you feel you are not getting the support.
If you have not received a reply on Modbus, please bump that thread with a reminder.

Chris,
Did you try my suggestions regarding CAN?
Leigh

Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by Chris_MIRA »

Hi,
Ive tried altering the RX to both mask / filter and accept all, the problem still exists (see attached FC8 file...)

However, Ive tried running the same programme in FC7 (I thought FC7 had been deleted during the upgrade, but found it...) and the programme functions correctly with the check Rx recognising a message.... the only difference I can see is that the CAN macro is imported from separate library's? i.e FC7 for the FC7 CAN file and FC8 for the FC8 file

regards,
Chris
Attachments
MEGA CAN Test 2 FC7 version.fcfx
(40.6 KiB) Downloaded 174 times
MEGA CAN Test 2.fcfx
(40.12 KiB) Downloaded 173 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by LeighM »

Hi Chris,
Can we just check a few things.
Could you use the ShowLEDS() to toggle the LEDs on the CAN board, this will prove that the SPI is OK.
Assuming that you are using an EBlock or have the CAN controller outputs available to test.
I notice that the V8 project uses Software SPI, the V7 uses hardware Channel 1, is that significant?
The only change I can see between V7 and V8 code is a small change to the Chip Select operation.

Secondly, you have the CAN controller osc crystal property set to 8MHz, this should be 20MHz for the CAN EBlock.
Are you using your own hardware with 8MHz crystal?
As I recall, the CAN controller will struggle to operate at 500kbs with a 8MHz crystal.

Thanks
Leigh

Chris_MIRA
Posts: 186
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

Re: CAN CheckRx(0) Not working?

Post by Chris_MIRA »

Hi,
With the V8 spi set to channel 1, everything works :D . Sorry I hadn't noticed this difference so had not tried it!
CAN works fine with the 8MHz in the arduino at 500baud.
Thanks again to MARTIX and everyone for your help!

Regards,
Chris

Post Reply