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?
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!
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.
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.
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:
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:
Then we need to enable the ADC0 interrupt in Platform Configuration -> Interrupt Controller:
Scroll down the Interrupt Controller page and find and enable ADC0:
Then we need to enable the ADC0 peripheral clock in MCU Configuration -> McuModuleConfiguration -> McuModeSettingConfig:
We need to add ADC0_EOC and ADC0_WD in ADC Configuration-> ADC Interrupt:
Then we need to add another ADC Hardware Instance in ADC configuration:
After we need to configure the Channel configurations array P6_ChanNum6:
Update the Adc0Group_2 with the Adc_Adc0Group2Notification in the Group configuration array:
Select the AdcChannel_1 in the AdcGroupDefinition:
After this we can Update Code and a pop-up Update Files will appear, press OK:
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:
Then go back to MATLAB and delete the following:
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
After the generated code is automatically flashed into the S32K311EVB, open FreeMaster and watch the newly added Channel_1:
Hope the steps above help you,
Stefan V.