MATLAB Answers

TMS320F28379D: Use DMA in CLA to Assign Counter Compare Values (Simulink Coder)

3 views (last 30 days)
David T.
David T. on 19 Mar 2021
Commented: David T. on 6 Apr 2021
Hello MW-Team,
I have a question regarding the DMA transfer of Counter Compare Values via the CLA using Simulink Coder. The example code "c28x7x_c28004x_dma_epwm.slx" is quite helpful, but compared to my code:
  • I dont want to "Enable DMA access to peripheral frame 1", because it disables the possibility to trigger CLA tasks via the eCAP or ePWM module etc. (from my understanding and test results)
  • I want to update the Counter Compare Values in the CLA
I hope you can find a solution to this using Simulink Coder. Thanks in advance.
Best Regards,
David T.

Accepted Answer

Venkatesh Chilapur
Venkatesh Chilapur on 6 Apr 2021
It is either DMA or CLA that can access the peripheral registers at a given time.
We choose between either DMA or CLA to access these peripherals.
Hence using DMA in CLA to access peripheral registers is not possible.
Secondly, if the DMA is enabled on peripheral Frame1(i.e DMA can access ePWM registers) we can use the duty_cycle_table approach to modulate the PWM output.
At the same time, this configuration will not block the possibility to trigger CLA tasks via the eCAP or ePWM module. Hence the ePWM module can continue to trigger the CLA task.
To demonstrate this, I have a put a model here attached(R2020b).
The model is 'F2837x_dma_cla_working.slx' which is found to be working on the F2837x Launchpad.
Here, the DMA and CLA workflows are merged.
The ePWM is configured to generate SOC interrupt to trigger DMA as well as ePWM interrupt for CLA Task trigger.
Both the triggers are working and the GPIO6 is toggled from CLA context. At the same time ePWM2A output is also modulated from duty_cycle_table.
There is a sineTableCalculation_data.m file that user needs to run after opening the 'F2837x_dma_cla_working' model to setup the duty_cycle_table.
After the build and download of the model is done, observe the PWM outputs on the J8-GPIO6 (CLA toggles this ouput) and J4-PWMOUT2A(DMA modulates this output)

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by