I'm able to transmit on-demand, using a 20ms timer, but it's a lot overhead... I'm looking for the driver function that would allow the message to be transmitted automatically at this rate.
The cpu overhead would be minimal.. just updating the message data as needed.
Python Function to Continuously Transmit
Re: Python Function to Continuously Transmit
Hello,
unfortunately, broadcast (automatic transmission) is supported neither by the device driver nor by the API itself. Using a timer or a thread is the normal way for doing this, so your approach is perfectly OK.
We will support this in a near future, but only for .NET applications.
unfortunately, broadcast (automatic transmission) is supported neither by the device driver nor by the API itself. Using a timer or a thread is the normal way for doing this, so your approach is perfectly OK.
We will support this in a near future, but only for .NET applications.
Best regards,
Keneth
Keneth
Re: Python Function to Continuously Transmit
I've never tried running .net on linux.. but hoping I can just get my existing Python app to be a bit more responsive.
Is there a way to setup the driver/API to issue an interrupt when the message has been successfully transmitted?
I'm thinking of using a thread to automatically transmit what's in a queue, whenever the previous message has been ACK'd. I think this should improve performance considerably.
Is there a way to setup the driver/API to issue an interrupt when the message has been successfully transmitted?
I'm thinking of using a thread to automatically transmit what's in a queue, whenever the previous message has been ACK'd. I think this should improve performance considerably.
Re: Python Function to Continuously Transmit
Hello,
yes, kind of. You can activate the parameter PCAN_ALLOW_ECHO_FRAMES. This causes your applicaiton to get an echo of any sent frame, this is, when you get an echo means the message was physically sent. The echo is placed in the receive queue of your application and is read like any other message, over the CAN_Read/CAN_ReadFD function.
Yes, you can use the echo frames as triggger to send the next message in your queue. Note that the API has only one queue per channel, so if you are already reading and processing messages somewhere in your code, you will need to synchronize that part with the new thread in charge of sending mesages,
Best regards,
Keneth
Keneth
Re: Python Function to Continuously Transmit
I've updated the driver (9/1/2022) and downloaded the latest pcan-basic zip (7/6/2022), and I it seems to mostly work.. i think the only issue I'm seeing has to do with filters.
Is it possible to filter out all messages on the bus, EXCEPT for my ECHO'd message that was ACK'd by the receiver?
I'm using the following to generate the 11-bit accept-code and accept-msg masks
https://gist.github.com/Lauszus/bd322b17b77c96f240fc
to filters out all node-ids and messages , but I'm seeing INCONSISTENT results in receiving MY message. If I open to receive all nodes/msgs then I always get my message.
Is there any special consideration for the accept filters when using the echo?
Is it possible to filter out all messages on the bus, EXCEPT for my ECHO'd message that was ACK'd by the receiver?
I'm using the following to generate the 11-bit accept-code and accept-msg masks
https://gist.github.com/Lauszus/bd322b17b77c96f240fc
to filters out all node-ids and messages , but I'm seeing INCONSISTENT results in receiving MY message. If I open to receive all nodes/msgs then I always get my message.
Is there any special consideration for the accept filters when using the echo?
Re: Python Function to Continuously Transmit
Hello,
this is only possible to a limited extent. For this, you need to configure the filter to only allow the IDs used for outgoing messages. Note that if you are receiving messages with the same IDs from another node, those messages are also received, so you still have to check the type of the received messages. The problem is, that echo messages are phisical received messages, this is, they are processed by the driver in the same manner as other recieved messages and passed throw the same filter as well.
As explained above, check that your filter is not discarding any of the IDs used for sending.
Best regards,
Keneth
Keneth