How to use FTM to trigger DMA request using FRDM K64?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to use FTM to trigger DMA request using FRDM K64?

1,205 次查看
oliviachristyva
Contributor III

Hi guys,

I am reading audio files from SD card in  k60 and putting it to the DAC out . From there i gave it to the G510 GSM audio pins and i hear the audio while making a call to the G510. It is successfully working .But now I need to make the same code using FRDM K64. and the code is not working . I think the issue is with FTM which generate signal to trigger DMA request.

This is my FTM code . It is working for K60. what changes should I make so that it works with FRDM K64.

bus clock is 50mhz for k60 and 60 mhz for frdm k64

void Init_FTM2(void)
{
SIM_SCGC3 |= SIM_SCGC3_FTM2_MASK; // enable clock to FTM2
SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK; // enable clock to PORTB

FTM2_C1SC |= FTM_CnSC_MSB_MASK | FTM_CnSC_ELSB_MASK | FTM_CnSC_CHIE_MASK | FTM_CnSC_DMA_MASK ; // PWM, true high pulses - generates DMA req
FTM2_MOD = (uint_32)((uint_32)BSP_BUS_CLOCK/(SAMPLERATE)); // 50MHz / 16000 = 3125.
FTM2_C0V = 1100; // any initial random value
FTM2_C1V = 50; // this value does NOT change -it is used to generate audio reload DMA request
// this starts the timer
FTM2_SC |= FTM_SC_CLKS(0x01) | FTM_SC_PS(0x00) ; // Bus Clock, divide-by-1
}

Please help

Thanks and Regards,

Olivia

0 项奖励
回复
1 回复

968 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Olivia,

I think the FTM module for both K60 and K64 is the same, so the FTM code in above function is right, you have to check the other code.

Hope it can help you

BR

Xiangjun Rong

0 项奖励
回复