[python-can] receive_own_messages

This forum covers third party software that is for example developed with our APIs
Post Reply
michel_h
Posts: 3
Joined: Fri 5. May 2023, 02:25

[python-can] receive_own_messages

Post by michel_h » Fri 5. May 2023, 02:35

Hello,
I am using the Python package python-can to interact with my PCAN device. This package is an abstraction layer that manages a variety of hardware interfaces.

Everything is working fine for me, including sending and receiving messages. However, I am having trouble receiving the messages that I send myself. Python-can provides a parameter for this called "receive_own_messages". I have tried setting this parameter to True using both of the following methods:

Code: Select all

import can
can.rc['receive_own_messages'] = True
and

Code: Select all

import can
bus = can.Bus(receive_own_messages=True)
Unfortunately, neither of these methods seem to be working. Is this feature supported by the PEAK device? If so, how can I make it work?

Thank you!

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: [python-can] receive_own_messages

Post by K.Wagner » Fri 5. May 2023, 08:51

Hello,

we do not know why python-can is not receiving own sent messages, since it is not an API from PEAK. Please ask questions related to it in a python-can forum.

Regarding the capability of PEAK devices to receive own sent messages, yes, this feature is supported. Using the PCAN-Basic API (fee free API, used by python-can to manage communication with PEAK devices), you can activate this via the parameter PCAN_ALLOW_ECHO_FRAMES. You find more information about it in the help files of PCAN-Basic. These are part of the PCAN-Basic package, that can be downlaoded here.
Best regards,
Keneth

michel_h
Posts: 3
Joined: Fri 5. May 2023, 02:25

Re: [python-can] receive_own_messages

Post by michel_h » Fri 5. May 2023, 16:27

Thank you for your reply. My code is intended to work with other devices as well, so I cannot use PCAN-Basic directly. I have not found a way to do something like the following pseudo-code:

Code: Select all

if device == pcan:
  PCAN_ALLOW_ECHO_FRAMES
If you are concerned about the compatibility of your device with python-can, you could suggest to the python-can GitHub to somehow link the receive_own_messages option with the PCAN_ALLOW_ECHO_FRAMES option.

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: [python-can] receive_own_messages

Post by K.Wagner » Fri 5. May 2023, 16:33

Hello,

As I said before, we can not give support on python-can. If you have any issue with it, please contact the maintainers and ask for a fix/review regarding this.

Thanks for your understanding.
Best regards,
Keneth

nicoletjunior
Posts: 2
Joined: Tue 3. Oct 2023, 15:49

Re: [python-can] receive_own_messages

Post by nicoletjunior » Tue 3. Oct 2023, 15:55

Hello,

It's great that you're using python-can to interact with your PCAN device. Regarding your issue with receiving the messages you send yourself, there are a few things you can check.

Firstly, the receive_own_messages parameter should indeed work for most supported hardware interfaces, including PEAK devices. However, you might want to verify if your specific PEAK device supports this feature. You can consult the documentation of your PEAK hardware or contact their customer support for clarification.

Assuming your PEAK device does support receiving your own messages, you can try the following steps to troubleshoot the issue:

Check Hardware Configuration: Ensure that your hardware setup is correct, and the PCAN device is properly connected and configured.

Update Drivers: Make sure you have the latest drivers and firmware for your PCAN device installed. Sometimes, updating drivers can resolve compatibility issues.

Check Message Filters: Confirm that your code isn't inadvertently filtering out the messages you're trying to receive. Double-check your filters to ensure they include the messages you're sending.

Error Handling: Implement error handling in your code to catch any exceptions or issues that may be occurring when setting receive_own_messages. This will help you identify the root cause of the problem.

Debugging: Use debugging techniques like printing debug information, logging, or using a debugger to step through your code. This can help you pinpoint where the issue is occurring.

However, if you are looking for a Top Python App Development Company, you can consider conducting a web search or checking directories and reviews to find the best fit for your project.

I hope this helps you resolve the issue with receiving your own messages using python-can with your PEAK device. If you have further questions or encounter more issues, please provide additional details, and I'll be happy to assist you.

(ext. link removed by admin - see board rules)

michel_h
Posts: 3
Joined: Fri 5. May 2023, 02:25

Re: [python-can] receive_own_messages

Post by michel_h » Tue 3. Oct 2023, 17:14

Thank you for your answer.
In the end, I'm not utilizing the feature to receive own messages. I've worked around the issue in the following manner: both incoming and outgoing messages are routed through a common handler that processes this data.

nicoletjunior
Posts: 2
Joined: Tue 3. Oct 2023, 15:49

Re: [python-can] receive_own_messages

Post by nicoletjunior » Wed 4. Oct 2023, 10:46

See out the wikipython page or python community

Post Reply