S32K358 Adc HW trigger example on S32K3X8EVB-Q289 EvalBoard

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

S32K358 Adc HW trigger example on S32K3X8EVB-Q289 EvalBoard

318件の閲覧回数
KalmanPolgar
Contributor I

Hi,

I currently working on ADC measurement possibilities of S32K358, focused on HW triggering.

I have started with SW triggered Adc_example_S32K358, it has been extended (Part4) to make Hw triggered ADC measurements.

Steps done:

  • to make an Adc instance with Hw triggering capability,
  • software for Adc measurement handling.

1.      Peripheral configuration

ADC instance config

In ADC configuration must be an instance (AdcHwUnit) to be configured  for DMA operation

ADC group config

In ADC configuration a group (AdcGroup) made for HW conversation.

AdcHwTrigger config

In AdcHwTrigger container AdcHwTrigger_5 added.

EMIOS instance config

In EMIOS configuration EMIOS_0 instance has been configured:

Emios Pwm instance config

In Emios Pwm configuration the for CH_5 has been configured for DMA request.

Dma Logic Channel config

As three Adc channels has been added to the ADC group for Hw triggering three Dma elements needed in ScatterGather element list to be configured.

 

2.      Sw implementation

The Hw triggering software example has the following steps:

  • AdcHwUnitDma  calibration and  buffer initiation,
  • Continuous Adc measurement cycle with enable and disable functionality,
  • Measurement result collection and value calculation.

 Simplified ADC measurement code:

ADCHWTriggerMain_x.jpg

Assert problem

Running of the SW implementation above, the start of Adc_EnableHardwareTrigger(HWGroup) will result the activation of the following assert:

Adc_Sar_Ip_SetCtuMode_DevAssert.jpg

 The problem is coming from the first part of DevAssert:

#define ADC_SAR_IP_INST_HAS_CTU(inst) ((Adc_Sar_Ip_au32AdcFeatureBitmap[inst] & (1UL << 2u)) != 0u)

The behevior is based on Adc_Sar_Ip_au32AdcFeatureBitmap configuration values, which are originated in Adc_Sar_Ip_HeaderWrapper_S32K3.h generated file:

Adc_Sar_Ip_au32AdcFeatureBitmap.jpg

where the ADC_SAR_IP_INSTANCE_COUNT value, in our case

#define ADC_SAR_IP_INSTANCE_COUNT           ADC_INSTANCE_COUNT

which is from S32K358_ADC.h

#define ADC_INSTANCE_COUNT                       (3u).

 

Changing the configuration value in line 151 /* Adc HW Unit 1 */ as it is in line 176 /* Adc HW Unit 1 */ the measurement works.

I don’t know what reason is behind the values defined for feature bitmap, is it acceptable to make the patch described above? Or is there any configuration step to make it work?

 

Thanks in advance,

Kalman

 

0 件の賞賛
1 返信

43件の閲覧回数
cuongnguyenphu
NXP Employee
NXP Employee
Looks that your reported version is a bug, I checked with S32K3XX RTD 4.0.0, this defined value 

FEATURE_ADC_FEAT_AVAIL_BITMAP has been changed to correct value:
cuongnguyenphu_0-1716348180865.png

 

I suggest you to install the latest version of S32K3 RTD 4.0.0
0 件の賞賛