DAC driver issue, jumps to DefaultISR

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

DAC driver issue, jumps to DefaultISR

ソリューションへジャンプ
894件の閲覧回数
therealfreegeek
Contributor IV

FRDMK64 board

KSDK 1.3

 

Hi, I just tried to use the DAC,I initialised the DAC using PE, basic setup without buffer.

 

I added these lines of my code;

 

 

DAC_DRV_StructInitUserConfigNormal(&daConv1_InitConfig0);

 

DAC_DRV_Init(daConv1_IDX, &daConv1_InitConfig0);

 

DAC_DRV_Output(daConv1_IDX, DACoutputValue);

 

I can single step into the first line but when the return is executed it jumps here (red text), in startup_MK64F12.S

 

 

DefaultISR:

 

 

   b DefaultISR

.size DefaultISR, . - DefaultISR

 

I would appreciate any help with this.

Thanks

Jim

ラベル(1)
1 解決策
646件の閲覧回数
marek_neuzil
NXP Employee
NXP Employee

Hi Jim,

I have checked you code and I have noticed the following warning:

passing argument 1 of 'DAC_DRV_StructInitUserConfigNormal' discards 'const' qualifier from pointer target type [enabled by default] main.c /Test DAC on K64/Sources line 56 C/C++ Problem

The Processor Expert generates the daConv1_InitConfig0 as a const variable (structure) that cannot be modified:

const dac_converter_config_t daConv1_InitConfig0 = {

  .dacRefVoltSrc = kDacRefVoltSrcOfVref1,

  .lowPowerEnable = false,

};

But the DAC_DRV_StructInitUserConfigNormal function initialize the daConv1_InitConfig0 structure. Therefore the exception is invoked.

In the case you use structures that are generated by Processor Expert you can use them directly. These structures are already initialized according to selected configuration in the fsl_dac component in your project.

If you use the default configuration the DAC device is already initialized in the PE_low_level_init().

PE_low_level_init() -> PEX_components_init() -> Components_Init() contains:

void Components_Init(void)

{

  /*! daConv1 Auto initialization start */

  DAC_DRV_Init(daConv1_IDX, &daConv1_InitConfig0);

  DAC_DRV_ConfigBuffer(daConv1_IDX, &daConv1_BufferInitConfig0);

  /*! daConv1 Auto initialization end */

}

It is mean that you can directly call the DAC_DRV_Output(daConv1_IDX, DACoutputValue) in your application (e.g. in the main() function after PE_low_level_init() function call).

Best Regards,

Marek Neuzil

元の投稿で解決策を見る

4 返答(返信)
646件の閲覧回数
therealfreegeek
Contributor IV

Hi Marek, thanks for that, still love PE and mourn its passing!

0 件の賞賛
返信
647件の閲覧回数
marek_neuzil
NXP Employee
NXP Employee

Hi Jim,

I have checked you code and I have noticed the following warning:

passing argument 1 of 'DAC_DRV_StructInitUserConfigNormal' discards 'const' qualifier from pointer target type [enabled by default] main.c /Test DAC on K64/Sources line 56 C/C++ Problem

The Processor Expert generates the daConv1_InitConfig0 as a const variable (structure) that cannot be modified:

const dac_converter_config_t daConv1_InitConfig0 = {

  .dacRefVoltSrc = kDacRefVoltSrcOfVref1,

  .lowPowerEnable = false,

};

But the DAC_DRV_StructInitUserConfigNormal function initialize the daConv1_InitConfig0 structure. Therefore the exception is invoked.

In the case you use structures that are generated by Processor Expert you can use them directly. These structures are already initialized according to selected configuration in the fsl_dac component in your project.

If you use the default configuration the DAC device is already initialized in the PE_low_level_init().

PE_low_level_init() -> PEX_components_init() -> Components_Init() contains:

void Components_Init(void)

{

  /*! daConv1 Auto initialization start */

  DAC_DRV_Init(daConv1_IDX, &daConv1_InitConfig0);

  DAC_DRV_ConfigBuffer(daConv1_IDX, &daConv1_BufferInitConfig0);

  /*! daConv1 Auto initialization end */

}

It is mean that you can directly call the DAC_DRV_Output(daConv1_IDX, DACoutputValue) in your application (e.g. in the main() function after PE_low_level_init() function call).

Best Regards,

Marek Neuzil

646件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Jim,

You can refer to the demo under the KSDK1.3 :

KSDK_1.3.0\examples\frdmk64f\driver_examples\dac

If still have error , you can send your project to me , i will check it  on my side .

BR

Alice

0 件の賞賛
返信
646件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Jim,

Have you checked to see if the DAC module has the clock enabled in the SIM_SCGC2 register before making those DAC calls?

Regards,

David

0 件の賞賛
返信