Can't setup adc with config tools. Sampled channels section shows all channels disabled.

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

Can't setup adc with config tools. Sampled channels section shows all channels disabled.

ソリューションへジャンプ
1,547件の閲覧回数
jaycrossbee
Contributor II

I am trying to continuously sample ADC0 CH1, and have set up using config tools from inside MCUXpresso. When I choose Sampled channels the channel number column always has disabled written at the end.

I suppose rather than continously sample, I would like to use the systemTick to trigger a single channel sample and conversion every 10 ms.

Can you please explain what I am doing wrong in the first paragraph and also how to use the systick to periodically sample instead?

The configTool screen of ADC setupThe configTool screen of ADC setupShowing the code before mainShowing the code before main

For the first paragraph, here is the autogenerated config info (with extra info) from peripherals.c 

/*Begin paste

/***********************************************************************************************************************
* ADC0 initialization code
**********************************************************************************************************************/
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
instance:
- name: 'ADC0'
- type: 'lpc_adc'
- mode: 'ADC'
- custom_name_enabled: 'false'
- type_id: 'lpc_adc_d74172b5bd0591c0d32a6c93c043a67f'
- functional_group: 'BOARD_InitPeripherals'
- peripheral: 'ADC0'
- config_sets:
- fsl_adc:
- doSelfCalibration: 'true'
- adcConfig:
- clockMode: 'kADC_ClockSynchronousMode'
- clockSourceFreq: 'BOARD_BootClockIRC12M'
- clockDividerNumber: '0'
- enableLowPowerMode: 'false'
- voltageRange: 'kADC_HighVoltageRange'
- thresholdConfig:
- ADC_SetThreshold0: 'false'
- thresholdSettingsPair0:
- lowValue: '0'
- highValue: '0'
- ADC_SetThreshold1: 'false'
- thresholdSettingsPair1:
- lowValue: '0'
- highValue: '0'
- enableSeqConfigurationA: 'true'
- adcConvSeqConfigA:
- enableHighPriority: 'true'
- adcConvSeqConfig:
- triggerMaskM: '0U'
- triggerPolarity: 'kADC_TriggerPolarityNegativeEdge'
- enableSyncBypass: 'false'
- enableSingleStep: 'false'
- interruptMode: 'kADC_InterruptForEachConversion'
- enableSeqConfigurationB: 'false'
- adcConvSeqConfigB:
- enableHighPriority: 'false'
- adcConvSeqConfig:
- triggerMaskM: '0U'
- triggerPolarity: 'kADC_TriggerPolarityNegativeEdge'
- enableSyncBypass: 'false'
- enableSingleStep: 'false'
- interruptMode: 'kADC_InterruptForEachConversion'
- channels:
- 0:
- channelName: ''
- channelNumber: 'CH.1'
- channelThresholdPair: 'thresholdPair0'
- thresholdInterruptMode: 'kADC_ThresholdInterruptDisabled'
- conversion_sequence: 'a'
- interrupt_sel: 'kADC_ConvSeqAInterruptEnable'
- enable_irq_seqA: 'true'
- adc_interrupt_seqA:
- IRQn: 'ADC0_SEQA_IRQn'
- enable_interrrupt: 'enabled'
- enable_priority: 'true'
- priority: '3'
- enable_custom_name: 'false'
- enable_irq_seqB: 'false'
- adc_interrupt_seqB:
- IRQn: 'ADC0_SEQB_IRQn'
- enable_interrrupt: 'enabled'
- enable_priority: 'false'
- priority: '0'
- enable_custom_name: 'false'
- enable_irq_thcmp: 'false'
- adc_interrupt_thcmp:
- IRQn: 'ADC0_THCMP_IRQn'
- enable_interrrupt: 'enabled'
- enable_priority: 'false'
- priority: '0'
- enable_custom_name: 'false'
- enable_irq_ovr: 'false'
- adc_interrupt_ovr:
- IRQn: 'ADC0_OVR_IRQn'
- enable_interrrupt: 'enabled'
- enable_priority: 'false'
- priority: '0'
- enable_custom_name: 'false'
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */
const adc_config_t ADC0configStruct = {
.clockDividerNumber = 0UL,
.enableLowPowerMode = false,
.voltageRange = kADC_HighVoltageRange,
};
/* Conversion sequence A configuration structure */
const adc_conv_seq_config_t ADC0ConvSeqAConfigStruct = {
.channelMask = 2U,
.triggerMask = 0U,
.triggerPolarity = kADC_TriggerPolarityNegativeEdge,
.enableSyncBypass = false,
.enableSingleStep = false,
.interruptMode = kADC_InterruptForEachConversion
};

static void ADC0_init(void) {
/* Perform self calibration */
ADC_DoSelfCalibration(ADC0_PERIPHERAL, ADC0_CLK_FREQ);
/* Initialize ADC0 peripheral */
ADC_Init(ADC0_PERIPHERAL, &ADC0configStruct);
/* Configure priority for sequence A */
ADC_SetConvSeqAHighPriority(ADC0_PERIPHERAL);
/* Configure the conversion sequence A */
ADC_SetConvSeqAConfig(ADC0_PERIPHERAL, &ADC0ConvSeqAConfigStruct);
/* Enable the conversion sequence A */
ADC_EnableConvSeqA(ADC0_PERIPHERAL, true);
/* Enable interrupt from ADC */
ADC_EnableInterrupts(ADC0_PERIPHERAL, kADC_ConvSeqAInterruptEnable);
/* Configure threshold compare interrupt on channel 1 */
ADC_EnableThresholdCompareInterrupt(ADC0_PERIPHERAL, 1U, kADC_ThresholdInterruptDisabled);
/* Interrupt vector ADC0_SEQA_IRQn priority settings in the NVIC. */
NVIC_SetPriority(ADC0_ADC_SEQ_A_IRQN, ADC0_ADC_SEQ_A_IRQ_PRIORITY);
/* Enable interrupt ADC0_SEQA_IRQn request in the NVIC. */
EnableIRQ(ADC0_ADC_SEQ_A_IRQN);
}

End past*/

ラベル(1)
0 件の賞賛
返信
1 解決策
1,530件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

You can use BURST mode, there is lpc_adc_burst demo under SDK.

 

BR

Alice

元の投稿で解決策を見る

2 返答(返信)
1,531件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

You can use BURST mode, there is lpc_adc_burst demo under SDK.

 

BR

Alice

1,526件の閲覧回数
jaycrossbee
Contributor II
Thank you Alice, that is what I wanted. Can you recommend where I would see how to start a conversion from the sysTick handler?
0 件の賞賛
返信