eCAN Transmit periodicity in C2000

10 views (last 30 days)
YJP
YJP on 2 Mar 2022
Commented: YJP on 21 Apr 2022
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.

Answers (1)

Dhanashree Mohite
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
YJP
YJP on 21 Apr 2022
Hi @Dhanashree Mohite,
I ran the same model on my hardware. I noticed that the periodicity between two successive CAN frames to be 0.95us. For a change, I tried changing the sampling time from 0.05 to 0.1 and 1. These are the CAN signals observed from the scope.
0.1s -
1s-
As you can see, both the configurations show the transmission rate of 95us, WHICH SHOULDNT BE POSSIBLE.
I am not sure how you got an output of 0.05 on the scope, but can you check it on the actual hardware on the CAN pins and see if you're getting the required periodicity. Because, from what it looks like( from the 0.1s and 1s, the sampling rate is not affecting the CAN periodicity in anyway.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!