writing variables problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

writing variables problem

Jump to solution
1,680 Views
hjhjhj
Contributor IV

Hi,

I try to write variables in Variable Watch by CAN communication.Sometimes it  succeeds ,while it often fails to set the variable value.

222.bmp

I am sure that FreeMASTER CAN communication is OK because reading variables is OK.Can you help me solve the writing variables problem?

0 Kudos
1 Solution
1,615 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello,

can you tell if you use the interrupt-driven or polling mode of FreeMASTER communication? You say that reading is 100% successful while writing often fails on communication timeout... This could be an issue that the FMSTR_Poll is not called fast enough in polling mode. In interrupt mode, it could also happen if the application would be disabling interrupts for long time. The Write command takes slightly longer time to process than the Read command - which could make the difference.

The issue could be also caused by wrong bus termination or imprecise clock. Can you try to lower the communication speed?

Also: does the failure occurs also with the FreeMASTER test application included in FreeMASTER driver? 

Thanks,

Michal

View solution in original post

3 Replies
1,615 Views
MichalH
NXP Apps Support
NXP Apps Support

Also, have you tried to increase the CAN response timeout in the FreeMASTER-over-CAN plug-in configuration? 

If none of the ideas help, please try to capture the CAN communication when writing the variable. Just to see if there is any response coming out from the target MCU.

pastedImage_1.png

Regards,

Michal

0 Kudos
1,615 Views
hjhjhj
Contributor IV

Hi Michal,

The problem has been solved now.The FMSTR_Poll is not called fast enough in polling mode.I put the FMSTR_Poll in the correct place and the writing variables function is OK.

Thanks,

HJ

0 Kudos
1,616 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello,

can you tell if you use the interrupt-driven or polling mode of FreeMASTER communication? You say that reading is 100% successful while writing often fails on communication timeout... This could be an issue that the FMSTR_Poll is not called fast enough in polling mode. In interrupt mode, it could also happen if the application would be disabling interrupts for long time. The Write command takes slightly longer time to process than the Read command - which could make the difference.

The issue could be also caused by wrong bus termination or imprecise clock. Can you try to lower the communication speed?

Also: does the failure occurs also with the FreeMASTER test application included in FreeMASTER driver? 

Thanks,

Michal