Hello. I am working on a project where i need to pass information from one variable to three different places, for this i am using three DMA's.
What i need to pass is the output information from a DAC, stored in "*ADC_DEC_SAMP_16B_PTR" and then it to my PWM compare variables.
The thing is that the PWM module cant do what i want, and therefor i am combining two PWM modules. For this i am using this:
http://www.cypress.com/blog/psoc-hacker-blog/high-resolution-high-freque...
It is working as it should, but now i can not just pass my ADC information directly to the PWM compare value, as i need to pass the MSB part of the variable to two inputs, and the LSB part to an other input.
I hae tried to use HI8 and LO8 to pass the right part, but i am not sure that i am doing the right thing (i am sure, as it does not work), and i am completely lost. My first DMA is set up like this:
void DMA_Config_1()
{
/* Defines for DMA_1 */
#define DMA_1_BYTES_PER_BURST 1
#define DMA_1_REQUEST_PER_BURST 1
#define DMA_1_SRC_BASE (CYDEV_PERIPH_BASE)
#define DMA_1_DST_BASE (CYDEV_PERIPH_BASE)
/* Variable declarations for DMA_1 */
/* Move these variable declarations to the top of the function */
uint8 DMA_1_Chan;
uint8 DMA_1_TD[1] = {0};
/* DMA Configuration for DMA_1 */
DMA_1_Chan = DMA_1_DmaInitialize(DMA_1_BYTES_PER_BURST, DMA_1_REQUEST_PER_BURST,
HI16(DMA_1_SRC_BASE), HI16(DMA_1_DST_BASE));
DMA_1_TD[0] = CyDmaTdAllocate();
CyDmaTdSetConfiguration(DMA_1_TD[0], 1, CY_DMA_DISABLE_TD, CY_DMA_TD_INC_DST_ADR);
CyDmaTdSetAddress(DMA_1_TD[0], HI8((uint32)(ADC_DEC_SAMP_16B_PTR)), LO16((uint32)PWM_2_COMPARE1_LSB_PTR));
CyDmaChSetInitialTd(DMA_1_Chan, DMA_1_TD[0]);
CyDmaChEnable(DMA_1_Chan, 1);
}
The other DMA's is set up in an equivalent way.
My output with the DMA's is different than my output with them (Without DMA's i have 50% duty cycle as expected). Pictures is attached.
This means that i am passing some kind of data, but it does not change with the input signal.
Can anyone give me a hint?