K32W061/QN9090/JN5189: How to select trigger for ADC?

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

K32W061/QN9090/JN5189: How to select trigger for ADC?

1,301 次查看
ckielstra
Contributor II

I want to do a single ADC conversion and trigger this from software. What do I specify for the TRIGGER bits?

Manual UM11323 for the K32W061 mentions in section 27.7.1:

Set the trigger source to an unused setting using the SEQ_CTRL[TRIGGER] bits. The
value 3, for example, is not used on this device.

Question 1) Is this TRIGGER source a number or a mask?

In the description of the TRIGGER field, section 17.1.3, it says:

Select which of the available hardware trigger sources will cause this conversion sequence to be initiated.
Program the trigger input number in this field. Setting: 0 : PINT0; 1 : PWM8; 2 : PWM9; 3 : ARM TX EV.

Here it says the field contains a number, i.e. you can only select one trigger source. An identical text can be found in UM10732 for the LPC11U6x/E6x. Which makes sense as that chip has 7 bits and 7 potential trigger sources.

But.... in the source code for the K32W061 ADC driver, fsl_adc.h, we read:

 

 

uint32_t triggerMask; /*!< Selects which one or more of the available hardware trigger sources will cause this
             conversion sequence to be initiated. The available range is 6-bit.*/

 

That's completely different! According to the source code the field is a mask and you can select multiple triggers.
Which is wrong? The User Manual, or the source code?

 

 

Question 2) Assuming that the manual is correct and that we have to configure a trigger number and not a trigger mask, then what is a good number for a software trigger?

UM11323 states:

 

The value 3, for example, is not used on this device.

This is incorrect, see above quote from section 17.1.3, numbers 0 to 3 are in use.

What is the suggested number to use?

Note that all code examples for the K32W061 use number 0 which I suspect to be wrong.

0 项奖励
回复
6 回复数

1,253 次查看
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello,

 

Hope you are doing well. The available trigger is the mentioned on the User Manual.

 

For Software-triggered conversion, please refer to section 27.6.3 of the K32W061/K32W041 User Manual.

Also, you can refer to the adc_interrupt SDK example. This example does a Software Trigger.

 

And, just as a comment, some of the SDK example set the Trigger to 0 or 2.

 

Hope this helps.

 

Regards,

Ricardo

0 项奖励
回复

1,195 次查看
ckielstra
Contributor II

Hello Ricardo,

 

Thanks for your reply.

 

For Software-triggered conversion, please refer to section 27.6.3 of the K32W061/K32W041 User Manual.

This doesn't help as that document seems to contain an error. In section 27.7.1, it states: 

Set the trigger source to an unused setting using the SEQ_CTRL[TRIGGER] bits. The
value 3, for example, is not used on this device.

In section 17.1.3 of the K32W061/K32W041 Register Manual, we see for TRIGGER (bit 17 to 12) that values 0, 1, 2 and 3 are in use.

 

Also, you can refer to the adc_interrupt SDK example. This example does a Software Trigger.

 

And, just as a comment, some of the SDK example set the Trigger to 0 or 2.

Well, this could also be a bug, couldn't it? I'm sure the examples work with these settings, but there is a risk of a spurious interrupt when the PINT0 (for 0) or PWM9 (for 2) is triggered.

 

0 项奖励
回复

1,164 次查看
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello,

 

Are you having any issue with the SDK example?

 

Regards,

Ricardo

0 项奖励
回复

1,096 次查看
ckielstra
Contributor II

Hi Ricardo,

 

The SDK examples 'work', but my problem is that all of them can suffer from a spurious ADC trigger. The documentation says to set the trigger source to an unused value. Values 0 and 2 from the examples might not be in use for these examples, but they are in my code, so are wrong for me.

So, I'm looking for a trigger configuration that's not connected to any hardware trigger. The ADC Conversion Sequence Control Register (SEQ_CTRL) has bits 12 to 17 reserved for trigger sources. Values 0 to 3 are in use. Am I correct in understanding that values 4 to 63 are safe to use for a software triggered ADC conversion?

0 项奖励
回复

1,014 次查看
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hi,

 

Are you having this issue in your implementation?

 

Could you please share the details to reproduce the issue?

 

Regards,

Ricardo

0 项奖励
回复

1,006 次查看
ckielstra
Contributor II

This discussion is going nowhere. I ask a question and you just ask new questions.

I'll try to rephrase my original question.

 

We see an error in the K32W061 User Manual.  Section 27.7.1 on spurious ADC readings: 

2. Set the trigger source to an unused setting using the SEQ_CTRL[TRIGGER] bits. The
value 3, for example, is not used on this device

This is wrong since the value 3 is in use, see section 17.1.3 of the K32W061/K32W041 Register Manual, for the TRIGGER field (bit 17 to 12).

My question: What is a save value that can always be used in this register for software triggers? (the SDK examples using values 0 and 2 are bad examples).

0 项奖励
回复