eCAN Transmit periodicity in C2000

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.

Réponses (1)

Dhanashree Mohite
Dhanashree Mohite le 21 Mar 2022

0 votes

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 commentaires

YJP
YJP le 22 Mar 2022
Hi @Dhanashree Mohite. Thanks for your response.
I have tried it as you have mentioned by setting Sampling time to 0.05s for the eCAP module as seen below.
The whole architecture is as follows
The output as observed on the oscilloscope is seen as follows
As seen here, the periodicity seems to be around 140us or 0.14ms.
So can you let me know if there is any mistake from my side? Or how I can proceed further?
Dhanashree Mohite
Dhanashree Mohite le 23 Mar 2022
Modifié(e) : Dhanashree Mohite le 23 Mar 2022
Can you please share the simulink model using which we can reproduce the same scenario?
YJP
YJP le 4 Avr 2022
Can I have a mail ID that I can mail it to?
Dhanashree Mohite
Dhanashree Mohite le 6 Avr 2022
You can share the model with reproduction steops here.
YJP
YJP le 6 Avr 2022
PFA the model. I have shared two possibilities. One where the CAN subsystem is getting triggered from a pulse generator at 50ms.
Other where it "inherits" the eCAP block's sample time. Please let me know if this works.
Dhanashree Mohite
Dhanashree Mohite le 19 Avr 2022
Hello,
I have attached a zip file containing
  1. Simple Target model which transmits counter data at 0.05 sec.
  2. Host Model which contains CAN receive blocks from VNT toolbox to receive data at 0.01s.
I observed that I am able to receive data in host at 0.05s (i.e the rate at which transmission is taking place). Hence, the CAN transmit block in traget model is inheriting the sample time of counter block.
Screenshot of received signal on host is added in the zipped folder.
YJP
YJP le 19 Avr 2022
The file format seems to be in the r2022b pre-release. Can you export it to one of the older versions -r2021a and resend it ?
Dhanashree Mohite
Dhanashree Mohite le 21 Avr 2022
PFA models exported in R2021a.
YJP
YJP le 21 Avr 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.

Connectez-vous pour commenter.

Catégories

Question posée :

YJP
le 2 Mar 2022

Commenté :

YJP
le 21 Avr 2022

Community Treasure Hunt

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

Start Hunting!

Translated by