eCAN Transmit periodicity in C2000
10 views (last 30 days)
Show older comments
I am using LaunchXL- F28379D to calculate rpm from hall sensors via eCAP module. I want to send this rpm via CAN which I am able to do.
I want to control the periodicity of this transmission at, say 50ms.
Initially I tried using a pulse generator whose output is given to a triggered Subsyst0em.
But the transmission rate seems to be somewhere around 0.5ms.
The subsystem takes input rpm and transmits via eCAN as shown below -
How do I get to adjust the periodicity of the transmitting messages.
Or how can I change my approach, considering that I might have to transmit more messages in the future.
0 Comments
Answers (1)
Dhanashree Mohite
on 21 Mar 2022
Hi,
As per my understanding, you are trying to transmit the signal at 50ms using eCAN transmit block. Please correct me if I am wrong.
The above requirement can be simply achieved by configuring the sample time of the eCAP block to 0.05 (i.e 50ms).
The eCAN transmit block will inherit the sample time of the input block and transmit the data at that sample time. I am assuming in your case, the input is coming from eCAP block. So, it will transmit the data at 0.05s.
We basically make use of timer0 to call step function based on the Sample time present for blocks in the model.
If the blocks in a model are using different sample times then the model will run at a base rate equal to greatest common divisor of all sample times present in the model. And a block will be executed specifically to its sample time. Enable sample time colors in your model to quickly watch which portion is executing at which rate.
Please refer Antonin's explanation present in MATLAB answer post for more details about sample time.
There is no need for a separate ePWM interrupt in this case, as we are already doing it internally by making use of timer0 for achieving the above requirement.
Thanks,
Dhanashree
9 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!