ADC0 causes a Hardware Fault interrupt.

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

ADC0 causes a Hardware Fault interrupt.

1,494 次查看
Automan
Contributor I

I have been able to configure the ADC1 in the S32 configuration tool and have successfully added 2 sampling groups. 

However, when I try to do the same for ADC0, I end up getting a Hardware Fault interrupt.

I have tried configuring both with and without ADC1 also configured, with the same results.

Is this a known issue with the MBDT?

0 项奖励
回复
5 回复数

1,431 次查看
Automan
Contributor I

Thanks, I had missed this step:

Then we need to enable the ADC0 peripheral clock in MCU Configuration -> McuModuleConfiguration -> McuModeSettingConfig:

Thank you for your assistance! 

0 项奖励
回复

1,415 次查看
stefanvlad
NXP Employee
NXP Employee

Hi @Automan ,

 

Yes, that step is usually forgotten by most users, enabling the peripheral clock in MCU Configuration -> McuModuleConfiguration -> McuModeSettingConfig.

You can select this thread Re: ADC0 causes a Hardware Fault interrupt. - NXP Community

and click on Accept as Solution,

 

Glad that now everything works ,

Stefan V.

0 项奖励
回复

1,471 次查看
stefanvlad
NXP Employee
NXP Employee

Hi @Automan ,

 

Are you using our latest NXP Model-Based Design Toolbox for S32K3 version 1.6.0.?

What board are you using and what model have you tried to configure the ADC0?

Also can you provide more details about the ADC configuration, screenshot and logs of the encountered error ?

 

Thank you,

Stefan V.

0 项奖励
回复

1,458 次查看
Automan
Contributor I

1. Yes, I am using the current 1.6.0 of the MBDT

2. I have tried it on the S32K311EVB and the S32K344EVB, it seems to be fine on the K344, but not the S311.

 

0 项奖励
回复

1,434 次查看
stefanvlad
NXP Employee
NXP Employee

Hi @Automan 

 

Thank you for using our latest NXP Model-Based Design Toolbox for S32K3 version 1.6.0.

We also have a guide on how to enable a new ADC channel for S32K3 boards Controlling LED intensity with ADC and PWM - NXP Community

 

In your case with the the S32K31XEVB-Q100 EVB board, there is only one ADC1 channel configured in the S32CT.

If you want to add an ADC0 channel, we need to first add a pin intro Pin Manager:

stefanvlad_0-1742911736443.png

For example PTE11 pin is on ADC0 and connected to TOUCHO_A on the board.

Next we need to add thisPTE11 pin in Peripherals -> Port Configuration:

stefanvlad_1-1742912080185.png

Then we need to enable the ADC0 interrupt in Platform Configuration -> Interrupt Controller:

stefanvlad_2-1742912269324.png

Scroll down the Interrupt Controller page and find and enable ADC0:

stefanvlad_3-1742912355616.png

Then we need to enable the ADC0 peripheral clock in MCU Configuration -> McuModuleConfiguration -> McuModeSettingConfig:

stefanvlad_4-1742912461293.png

We need to add ADC0_EOC and ADC0_WD in ADC Configuration-> ADC Interrupt:

stefanvlad_9-1742915526937.png

Then we need to add another ADC Hardware Instance in ADC configuration:

stefanvlad_10-1742915808361.png

After we need to configure the Channel configurations array P6_ChanNum6:

stefanvlad_11-1742915864741.png

Update the Adc0Group_2 with the Adc_Adc0Group2Notification in the Group configuration array:

stefanvlad_17-1742917058907.png

Select the AdcChannel_1 in the AdcGroupDefinition:

stefanvlad_8-1742915342488.png

After this we can Update Code and a pop-up Update Files will appear, press OK:

stefanvlad_5-1742912566074.png

After this process is done, we can close S32CT and go back to the model.

Update in the s32k3xx_adc_single_read_s32ct model, with Adc0Group_2:

stefanvlad_13-1742916459810.png

stefanvlad_14-1742916500213.png

Then go back to MATLAB and delete the following: 

  • s32k3xx_adc_single_read_s32ct_ert_rtw
  • slprj
  • s32k3xx_adc_single_read_s32ct.slxc

stefanvlad_6-1742912930708.png

Select Yes to all, then go back to the s32k3xx_adc_single_read_s32ct.mdl and press on Build, Deploy &Start (keyboard shortcut CTRL+B

stefanvlad_15-1742916594361.png

After the generated code is automatically flashed into the S32K311EVB, open FreeMaster and watch the newly added Channel_1:

stefanvlad_16-1742916888981.png

 

Hope the steps above help you,

Stefan V.

0 项奖励
回复