extra signals DMA example epm Duty Cycle
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gauthier Mervillie
el 11 de Mzo. de 2019
Editada: Osvaldo Gonza
el 14 de Jul. de 2022
Hello everyone,
For my project I'm using MATLAB and SIMULINK to program the TI Launchpad. The program C2000 and Matworks both provide an example to generate a variable PWM signal. The link to this example is given here: https://nl.mathworks.com/help/supportpkg/texasinstrumentsc2000/ug/modify-epwm-using-dma.html
I could implement the signal without a problem, but now is my question how I can get three such variable signals out of the TI Launchpad. I tried understanding the program behind it, but without succes. The result I want in the end is a three phase inverter with 120° phase difference. Below you can see what I tried to do:
![PWM_generator.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/207831/PWM_generator.jpeg)
I was able to get three signals on the Launchpad, but only one had variable pwm. More precisely, the one which was already present in the example. Hope you can help me with this issue
Thanks in advance!
0 comentarios
Respuesta aceptada
Venkatesh Chilapur
el 18 de Mzo. de 2019
Hi Gauthier,
That can complicate things as the DMA runs in steps of 1, picking next value from table until 500 such iterations are done to copy all entries from duty_cycle_table over a period of time where we get 1 full sine wave. However starting the source address with a offset will actually make the DMA overshoot the table entries as the transfer size is 500. It would call for complicated configuration of the DMA which I am not sure is currently supported. For more information on specific configuration of the DMA to suit an application scenario it would be best to talk to experts at TI E2E forum. Please can you accept the post as an answer so that in future we can guide customers to this looking for similiar information.
Regards,
Venkatesh C
Más respuestas (9)
Venkatesh Chilapur
el 11 de Mzo. de 2019
Hi Gauthier,
You may not need other DMA's for generating rest of the PWM's.
Once you have the First ePWM working, you can synchronize the rest of the PWM's to the Master. Master is the ePWM which is generated using DMA.
We provide an option to provide the Phase delay after synchronization in the ePWM block which can be used in this case.
'Phase offset value (TBPHS)'
More details for the configurations options available in ePWM block is provided below:
There is also a TI e2e post which talks about this possibility.
You may want to explore this option for your implementation.
Regards,
Venkatesh C
Venkatesh Chilapur
el 11 de Mzo. de 2019
Hi,
Please refer this video:
In the video at time 6:45 we cover the PWM synchronization topic. That will give a fare idea on how PWM can be synchronized to each other. In your case you need them to be 120 deg in phase offset, so the TI post can be handy for the same.
Regards,
Venkatesh C
1 comentario
Venkatesh Chilapur
el 12 de Mzo. de 2019
Hi Gauthier,
Keeping aside the operation of DMA in this example, we can synchronize the PWM output with help of following configuration.
The following figure provides an idea on the synchronization scheme.
![Capture.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208072/Capture.jpeg)
So inline with this, we can configure ePWM1 as MASTER for ePWM2 and subsequently for ePWM3 time synchronization.
In order to achieve this in configuration we set SYNCO to the condition as captured below.
![tempsnip.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208073/tempsnip.jpeg)
With this, when the ePWM1 Time base counter equals zero, the SYNCO output will provide the synchronization input to ePWM2.When this happens, the Time base counter of ePWM2 will be updated almost inline the time when the counter of ePWM1 gets updated.
Now we need to configure the ePWM2 for this sync.
![tempsnip1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208074/tempsnip1.jpeg)
In the first marker, we specify ePWM1 is the source for sync. In the second marker the action that needs to be taken when the sync event occurs. If we choose to set the TBPHS say a value of 50, then Time base counter will start from 50 onwards at the sync event for ePWM2, unlike the ePWM1 which starts from 0. So we have achieved a phase offset here. In the last Mark we allow this sync event to the next ePWM in the ladder which is ePWM3.
Now coming to the example:
Here we are updating the CMPA compare value for the given ePWM module using DMA. If we intend to use these values for other PWM also, then we need to configure the DMA channels for those PWM's as well. But the synchronization part is achieved by the configuration as decribed above including phase offset config as described.
Regards,
Venkatesh C
0 comentarios
Venkatesh Chilapur
el 14 de Mzo. de 2019
Hi Gauthier,
To implement deadband, please do the following.
Keep all box un-checked for the ePWMxB as shown below as to produce classical dead-band waveforms the
default is ePWMxA.![Untitled.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208441/Untitled.jpeg)
![Untitled.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208441/Untitled.jpeg)
Under Deadband config pane do the following:
![Capture.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208442/Capture.jpeg)
And with these settings I could get the waveform with deadband.
![1bd01047-e8cb-4ba7-9b51-4fcb4b3542a9.jfif](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208443/1bd01047-e8cb-4ba7-9b51-4fcb4b3542a9.jpeg)
Hope this helps.
Regards,
Venkatesh C
1 comentario
Gauthier Mervillie
el 15 de Mzo. de 2019
Editada: Gauthier Mervillie
el 15 de Mzo. de 2019
Venkatesh Chilapur
el 15 de Mzo. de 2019
Hi Gauthier,
If you get 200 values in the duty cycle table then you may need to update the DMA configuration w.r.t this. We set the transfer size base on the number of entries in the duty_cycle_table.
![Capture.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208573/Capture.jpeg)
The field as highlighted above needs to be updated with 200 now. Please try this and let me know if it helps.
Regards,
Venkatesh C
1 comentario
Venkatesh Chilapur
el 15 de Mzo. de 2019
Hi Gauthier,
I may need your model. Can you attach the up to date model.?
Regards,
Venkatesh C
0 comentarios
Venkatesh Chilapur
el 18 de Mzo. de 2019
Hi Gauthier,
As I mentioned, since the Master ePWM is configured to react on CMPA count and we update the same using DMA ch 1, we need to do the same for other ePWM as they cannot be synchronized for CMPA values but only for TBPRD value. So, from your model I could see the DMA ch as required to update the CMPA value for ePMW8A and ePMW9A are not configured. You can configure DMA ch 2 for ePWM8A and DMA ch 3 for ePWM9A such that, there CMPA values are also copied and that way all 3 ePWM output can be in sync. When configuring the DMA ch, ensure to update the destination register value for ePMW8A and ePMW9A and keep the source same i.e 'duty_cycle_table'. Please let me know if this helps.
For example:
Enable the DMA channel as shown in below fig and configure for ePWM8A. Similarly enable DMA channel3 for ePWM9A.
![Capture.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208944/Capture.jpeg)
2 comentarios
Osvaldo Gonza
el 10 de Jul. de 2022
Editada: Osvaldo Gonza
el 14 de Jul. de 2022
I have been following your question. I am also trying to implement a three phase inverter with a 120° phase difference using DMA with MATLAB and SIMULINK and I have the same issue. How can I acquire a 120° difference between the other sine waves?
Kind regards
Oswal
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!