RT117x: Multichannel ADC read

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

RT117x: Multichannel ADC read

ソリューションへジャンプ
942件の閲覧回数
SecularC
Contributor I

Hello,

I am using NXP Model-Based Design Toolbox for iMXRT117x and have multiple channels to read from. However, using multiple ADC Read blocks results in compile error as multiple lines of the following code are placed in code:

lpadc_conv_result_t mLpadcResultConfigStruct[%<adcParams.commandsNumber>];
const uint32_t g_LpadcResultShift = %<resultShift>;

The Help dialog box and example only demonstrate a single ADC read and that the output is the converted value. How can I do this for multiple ADC channels to read from?

I am using version 1.3.0 of the toolbox.

0 件の賞賛
返信
1 解決策
835件の閲覧回数
SorinIBancila
NXP Employee
NXP Employee

Hello,

I've attached an example that reads from 3 channels as below:

- XBAR0_TRIG.0: Read voltage (COMMAND ID 1) on J9[10]

-XBAR0_TRIG.1: Read voltage (COMMAND ID 2 and 3) on J26[12] and J26[2], respectively.

In this example, the trigger to read ADC values is done via Software (ADC_ETC_START blocks), which is ran at every step execution (once 0.2s).

XBAR0_TRIG.0 triggers the ADC_ETC_IRQ0_IRQHandler interrupt, which read the voltage on J9[10] (Data Memory Chan1) and increment the variable counter_trig0.

XBAR0_TRIG.1 triggers the ADC_ETC_IRQ1_IRQHandler interrupt, which read the voltage on J26[12] (Data Memory Chan2) and J26[2] (Data Memory Chan3)  and increment the variable counter_trig1.

Please use the included FreeMASTER project to check the values of all these variables. In the image below, I used a 1.21V reference voltage applied on all 3 channels, one at a time. As there are no pulldown/pullup resistors, if no voltage is applied, the read values is floating around random values.

SorinIBancila_0-1742485923450.png

 

Best regards,

Sorin Bancila

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
836件の閲覧回数
SorinIBancila
NXP Employee
NXP Employee

Hello,

I've attached an example that reads from 3 channels as below:

- XBAR0_TRIG.0: Read voltage (COMMAND ID 1) on J9[10]

-XBAR0_TRIG.1: Read voltage (COMMAND ID 2 and 3) on J26[12] and J26[2], respectively.

In this example, the trigger to read ADC values is done via Software (ADC_ETC_START blocks), which is ran at every step execution (once 0.2s).

XBAR0_TRIG.0 triggers the ADC_ETC_IRQ0_IRQHandler interrupt, which read the voltage on J9[10] (Data Memory Chan1) and increment the variable counter_trig0.

XBAR0_TRIG.1 triggers the ADC_ETC_IRQ1_IRQHandler interrupt, which read the voltage on J26[12] (Data Memory Chan2) and J26[2] (Data Memory Chan3)  and increment the variable counter_trig1.

Please use the included FreeMASTER project to check the values of all these variables. In the image below, I used a 1.21V reference voltage applied on all 3 channels, one at a time. As there are no pulldown/pullup resistors, if no voltage is applied, the read values is floating around random values.

SorinIBancila_0-1742485923450.png

 

Best regards,

Sorin Bancila

0 件の賞賛
返信
808件の閲覧回数
SecularC
Contributor I

Thanks for your example. Is it possible to perform a multi-channel read using just the LPADC blocks, or is it necessary to use the ADC_ETC? I do not need any external hardware triggers but will need a software trigger.

0 件の賞賛
返信
791件の閲覧回数
SorinIBancila
NXP Employee
NXP Employee

Hello,

Unfortunately, it is not possible to use multiple LPADC blocks. Only way to read multiple channel is to use the ADC_ETC.

The example that I attached in the previous reply includes a multi-channel read, using software triggers (ADC_ETC_Start blocks)..
Best regards,
Sorin Ioanid

0 件の賞賛
返信
911件の閲覧回数
SecularC
Contributor I
Bumping
0 件の賞賛
返信