eCAN Transmit periodicity in C2000
Afficher commentaires plus anciens
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
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
le 22 Mar 2022
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
le 4 Avr 2022
Dhanashree Mohite
le 6 Avr 2022
You can share the model with reproduction steops here.
YJP
le 6 Avr 2022
Dhanashree Mohite
le 19 Avr 2022
Hello,
I have attached a zip file containing
- Simple Target model which transmits counter data at 0.05 sec.
- 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
le 19 Avr 2022
Dhanashree Mohite
le 21 Avr 2022
PFA models exported in R2021a.
YJP
le 21 Avr 2022
Catégories
En savoir plus sur Real-Time Deployment dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




