-
AuthorPosts
-
-
Hi
I have a question regarding sending CAN messages using FlexBench v1.2.
I am trying to use CAN to control a BLDC driver I have. I could send and receive data using the CAN example which is on your website. However, this example is always (every time step) sending data on the CAN bus which is not what I want. My aim is to send the data over CAN whenever I want and only for one or a couple of cycles. Let’s say I have a variable that I want to use it to trigger the CAN communication. When this variables becomes one, I want to send the data only for once (or a couple of times). After that, I want to to again wait for the trigger signal to send the data again. I used action ports and triggered subsystem but I was not able to achieve the process I want. Using these methods, the CAN message is not sent before triggering, however as soon as I trigger the system, FB send the message all the time and does not stop even when I untrigger the system. Do you know how we can only send CAN message for a one or a couple of cycles only?
I also faced another issue during this process. that I could not change the message I am sending. For example, I made the message that wI want to change volatile so I can change it using FreeMaster. However, although I change the message, I still see the previous message being sent. I am not sure if this is due to buffering of the previous signals or there is another problem. Have you ever had such a problem?Thanks
Amin -
Hi Amin,
Is this variable that you use to trigger a CAN message coming from another peripheral or are you just setting it in FreeMaster? If it is a boolean variable, you can construct a “rising edge detect” by triggering the subsystem when the current value is 1 and the current value is different from the previous.
For the CAN message not changing, try to construct your CAN message in a similar way to how the default SPI communication works: individual variables merged into an array and passed to the CAN send block. Sometimes trying to edit an entire array through FreeMaster can add unnecessary complication.
-
-
AuthorPosts
- You must be logged in to reply to this topic.