AnsweredAssumed Answered

DAC read pointer update with Hardware Trigger

Question asked by Nadine Sueur on Jun 21, 2016
Latest reply on Jun 24, 2016 by xiangjun.rong

Hello,

I'm using a FRDM-K64F board, under Kinetis SDK v2.

I have configured the DAC to use the hardware trigger. The DAC is enable, the DAC buffer is enabled,

The DAC buffer work mode is set to Normal mode.

The problem I have, is that I never seen the read pointer changing. I always remains to the initial value of zero.

 

I have joined a test program to this email.

I run the associated program, and oscope the DAC0_OUT pin of the board.

 

=> If the line 155, in the file main.c is commented, a sinus curve is displayed.

But, the data are always written in the first entry of the Fifo.

 

=> If the line 155, in the fila main.c is un-commented, then a constant output appears.

 

//  DACIndexBuffer  = (DACIndexBuffer  + 1)  % DAC_USED_BUFFER_SIZE;

 

I have probably made a mistake in the DAC initialization or usage.

Thanks for your remarks.

 

Best Regards

Nadine

void PDB_IRQ_HANDLER(void){ uint32_t i;
GPIO_WritePinOutput(BOARD_DEBUG_GPIO1, BOARD_DEBUG_GPIO1_PIN, 0); for (i = 0; i < PDB_DAC_INDX_LOOP; i++) { DAC_BASEADDR->DAT[DACIndexBuffer].DATH = dath[sinusIndexTable]; /* High 4-bit. */ DAC_BASEADDR->DAT[DACIndexBuffer].DATL = datl[sinusIndexTable]; /* Low 8-bit.  */
//DACIndexBuffer  = (DACIndexBuffer  + 1)  % DAC_USED_BUFFER_SIZE; sinusIndexTable = (sinusIndexTable + 1)  % INP_BUFFER_SIZE; }
#if 0 DACRegister[reg_index++] = DAC_BASEADDR->C2; if (reg_index == 20) { for (i = 0; i< 20; i++) PRINTF("i %d  value = 0x%x\r\n", i , DACRegister[i]); reg_index = 0; }#endif
PDB_ClearStatusFlags(PDB_BASEADDR, kPDB_DelayEventFlag); GPIO_WritePinOutput(BOARD_DEBUG_GPIO1, BOARD_DEBUG_GPIO1_PIN, 1);}

Original Attachment has been moved to: DAC.zip

Outcomes