AnsweredAssumed Answered

Operate DAC in mkl27Z644, ( LQFP64)

Question asked by zvika grinberg on Jan 22, 2020
Latest reply on Feb 8, 2020 by zvika grinberg

Operate DAC in mkl27Z644, ( LQFP64)



I have to operate PTE30 as DAC0_OUT, but without any success.

Few general questions:


1) Did I need to operate the comparator ? what the input channle I configure as "kCmpInputChnDac"

2) The filter Mode ? 

3) Did I need to configure PTE30 to an alternative ? 

4) I have also try to set the registers manually Via the IAR debugger, and still Noting changed.


Please Advise.


My Code is :


// Configuration for cmp
cmp_state_t cmpState;
cmp_comparator_config_t cmpUserConfig;
cmp_sample_filter_config_t cmpSampleFilterConfig;
cmp_dac_config_t cmpDacConfig;


// Disable falling interrupt
// Init the CMP comparator.
CMP_DRV_StructInitUserConfigDefault(&cmpUserConfig, (cmp_chn_mux_mode_t)BOARD_CMP_CHANNEL, kCmpInputChnDac);
cmpUserConfig.risingIntEnable = false;
cmpUserConfig.fallingIntEnable = false;
CMP_DRV_Init(BOARD_CMP_INSTANCE, &cmpState, &cmpUserConfig);

// Configure the internal DAC when in used.
cmpDacConfig.dacEnable = true;
cmpDacConfig.dacValue = 32; // 0U - 63U
cmpDacConfig.refVoltSrcMode = kCmpDacRefVoltSrcOf2;
CMP_DRV_ConfigDacChn(BOARD_CMP_INSTANCE, &cmpDacConfig);

// Configure the Sample/Filter Mode.
cmpSampleFilterConfig.workMode = kCmpContinuousMode;
CMP_DRV_ConfigSampleFilter(BOARD_CMP_INSTANCE, &cmpSampleFilterConfig);

// Start the CMP function.