Setting DMA with ADC in F28335 (2018a/2020b)

4 views (last 30 days)
Hello,
I am in the second round configuring DMA with ADC in F28335 with TI C2000 support package. Now I am using Matlab 2020b. I am struggling with the memory allocation definitions in Simulink.
I need DMA ch1 to transfer the data adquired by ADC to an user defined memory allocation. I have 10 channels, so I have configured it for a Burst size of (10-1). I'm using a Data store and Memory allocation blocks to access stored data as in Matlab example c28x7x_c28004x_dma_epwm
My Burst source address is the ADC register (following controlsuite examples): &AdcMirror.ADCRESULT0
My Burst destination address is a buffer ADCbuffer[10], so I set: &ADCbuffer[0]
If I define ADCbuffer in Simulink environment, I mean, Model properties/Callbacks, or even in Model explorer/Model environment as a Simulink.signal, I find that the compiler gives an error in DMA configuration because ADCbuffer is not defined.
However, if I define it in a custom header in Configuration parameters/Custom code, as (taken from controlsuite/adc_dma example):
#pragma DATA_SECTION(ADCbuffer,"DMARAML4");
volatile Uint16 ADCbuffer[10];
Now I get that ADCbuffer is defined in all .obj files...
Other setups gave me catastrophic errors...
The example c28x7x_c28004x_dma_epwm sets the Burst source address as duty_cycle_table, a signal generated by executing "sineTableCalculation" comand in Model properties/Callbacks, at InitFcn as well as at PreLoadFcn.
So I would be really grateful to get some advice:
  • Where should I define the DMA buffer?
  • It is needed a specific variable type?
  • Additional tips to take into account?
Thank you for your time.

Answers (0)

Community Treasure Hunt

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

Start Hunting!