完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
Hi:NXP TechSupport,我有类似的问题,我用了LPADC模块的ADC1 [N13] GPIO_AD_06 CHANNEL0和[P17] GPIO_AD_12 CHANNEL3,发现CHANNEL0的ADC值是正确的,CHANNEL3的ADC值为始终为 4095。但我使用的是 SDK_2_12_1_MIMXRT1170-EVK.zip SDK,所以我认为我的配置可能有问题。你能帮我查一下吗
这是我的配置 const lpadc_config_t LPADC1_config = { .enableInDozeMode = true, .enableAnalogPreliminary = false, .powerUpDelay = 0x80UL, .referenceVoltageSource = kLPADC_ReferenceVoltageAlt2, .powerLevelMode = kLPADC_PowerLevelAlt1, .triggerPriorityPolicy = kLPADC_TriggerPriorityPreemptimmediately, .enableConvPause = false, .convPauseDelay = 0UL, .FIFOWatermark = 0UL, }; lpadc_conv_command_config_t LPADC1_commandsConfig[2] = { { .sampleScaleMode = kLPADC_SampleFullScale, .sampleChannelMode = kLPADC_SampleChannelSingleEndSideA, .channelNumber = 0U, .chainedNextCommandNumber = 2, .enableAutoChannelIncrement = false, .loopCount = 0UL .hardwareAverageMode = kLPADC_HardwareAverageCount1, .sampleTimeMode = kLPADC_SampleTimeADCK3, .hardwareCompareMode = kLPADC_HardwareCompareDisabled, .hardwareCompareValueHigh = 0UL, .hardwareCompareValueLow = 0UL, }, { .sampleScaleMode = kLPADC_SampleFullScale, .sampleChannelMode = kLPADC_SampleChannelSingleEndSideA, .channelNumber = 3U, .chainedNextCommandNumber = 0, .enableAutoChannelIncrement =假, .loopCount = 0UL, .hardwareAverageMode = kLPADC_HardwareAverageCount1, .sampleTimeMode = kLPADC_SampleTimeADCK3, .hardwareCompareMode = kLPADC_HardwareCompareDisabled, .hardwareCompareValueHigh = 0UL, .hardwareCompareValueLow = 0UL, } }; lpadc_conv_trigger_config_t LPADC1_triggersConfig[2] = { { .targetCommandId = 1, .delayPower = 0UL, .priority = 1, .enableHardwareTrigger = true }, { .targetCommandId = 2, .delayPower = 0UL, .priority = 1, .enableHardwareTrigger = false } }; static void LPADC1_init(void) { /* 初始化 LPADC 转换器 */ LPADC_Init(LPADC1_PERIPHERAL, &LPADC1_config); /* 配置转换命令 1。 */ LPADC_SetConvCommandConfig(LPADC1_PERIPHERAL, 1, &LPADC1_commandsConfig[0]); /* 配置转换命令 2。 */ LPADC_SetConvCommandConfig(LPADC1_PERIPHERAL, 2, &LPADC1_commandsConfig[1]); /* 配置触发器 0。 */ LPADC_SetConvTriggerConfig(LPADC1_PERIPHERAL, 0, &LPADC1_triggersConfig[0]); /* 配置触发器 1。 */ LPADC_SetConvTriggerConfig(LPADC1_PERIPHERAL, 1, &LPADC1_triggersConfig[1]); /* NVIC 中的中断向量 ADC1_IRQn 优先级设置。*/ NVIC_SetPriority(LPADC1_IRQN, LPADC1_IRQ_PRIORITY); /* 启用来自 LPADC 的中断 */ LPADC_EnableInterrupts(LPADC1_PERIPHERAL, (kLPADC_FIFOWatermarkInterruptEnable)); /* 在 NVIC 中启用中断 ADC1_IRQn 请求。*/ EnableIRQ(LPADC1_IRQN); } void DEMO_LPADC_IRQ_HANDLER_FUNC(void) { #if 0 ADC_ETC_ClearInterruptStatusFlags(DEMO_ADC_ETC_BASE, kADC_ETC_Trg0TriggerSource, kADC_ETC_Done0StatusFlagMask); g_AdcConversionDoneFlag = true; /* 从触发源链 0 中获取结果 */ g_AdcConversionValue[0] = ADC_ETC_GetADCConversionValue(DEMO_ADC_ETC_BASE, DEMO_ADC_ETC_TRIGGER_GROUP, 0U); g_AdcConversionValue[1] = ADC_ETC_GetADCConversionValue(DEMO_ADC_ETC_BASE, DEMO_ADC_ETC_TRIGGER_GROUP, 3U); __DSB(); #else g_LpadcInterruptCounter++; #if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2U)) 如果 (LPADC_GetConvResult(DEMO_LPADC_BASE, &g_LpadcResultConfigStruct, 0U)) #else 如果 (LPADC_GetConvResult(DEMO_LPADC_BASE, &g_LpadcResultConfigStruct)) #endif /* FSL_FEATURE_LPADC_FIFO_COUNT */ { g_LpadcConversionCompletedFlag = true; } SDK_ISR_EXIT_BARRIER; #endif } int main(void) { uint32_t pwmVal = 4; /* 电路板引脚、时钟、调试控制台初始化 */ BOARD_ConfigMPU(); BOARD_InitPins(); BOARD_BootClockRUN(); BOARD_InitBootPeripherals(); BOARD_InitDebugConsole(); /* 向终端打印一条注释。*/ 而 (1) { SDK_DelayAtLeastUs(100000, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U 是 trigger0 掩码。*/ } } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
1935个成员聚集在这个小组
加入小组我的项目我做主,使用GN+Ninja来完成构建系统(VSCode开发RT106X)
36428 浏览 0 评论
NXP IMX8应用处理器快速入门必备:技巧、使用、设计指南
4981 浏览 1 评论
6114 浏览 1 评论
6821 浏览 0 评论
NXP i.MX6UL开发板(linux系统烧录+规格+硬件+模块移植)使用手册
4252 浏览 0 评论
654浏览 2评论
求助,S32G上Core M启动后如何让Core A在Flash指定位置加载uboot?
646浏览 2评论
ESP32-WROVER-IE + LAN8720以太网,GPIO0电压只有1.6v,无法正常进入spi flash boot模式如何解决?
647浏览 2评论
求分享适用于PN7160 Android的NFC工厂测试应用程序
737浏览 2评论
849浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 12:04 , Processed in 1.062091 second(s), Total 74, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号