主题中讨论的其他器件: SysConfig
我有一个 MSP432E401Y FreeRTOS 项目、该项目使用4个不同的 ADC 通道。 其中一个 ADC (PK3)监视电位计的抽头。 无论电位器的实际状态如何、从该 ADC 读取的值似乎每隔几秒偶尔从1.8V 跳到3.3V。 我已经用示波器和电压表探测了电路板。 我已验证引脚21 (PK3)已用非常精密的探头连接到电位计、并且我的仪器读取了正确的电压。 其他 ADC 的工作非常出色、精度很高。 有人知道这可能是什么原因吗?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我有一个 MSP432E401Y FreeRTOS 项目、该项目使用4个不同的 ADC 通道。 其中一个 ADC (PK3)监视电位计的抽头。 无论电位器的实际状态如何、从该 ADC 读取的值似乎每隔几秒偶尔从1.8V 跳到3.3V。 我已经用示波器和电压表探测了电路板。 我已验证引脚21 (PK3)已用非常精密的探头连接到电位计、并且我的仪器读取了正确的电压。 其他 ADC 的工作非常出色、精度很高。 有人知道这可能是什么原因吗?
您好!
我有几个问题:
-您使用的是哪个采样序列发生器?
-对于实验,如果你只从 PK3中采样一个通道,而不是四个通道,该怎么办。 可以在 PK3上重复同样的问题吗?
-如果你交换样本输入的顺序? 例如、如果将 PK3 (AIN19)设置为要在其他三个通道之前采样的第一个通道、会发生什么情况?
-可以在 LaunchPad 上重复同样的问题吗?
-对于实验,不确定你是否可以使用 PK2 (AIN18)来采样雨刮器? 是否会产生相同问题? 我想知道这是不是特定于 AIN19的问题。
您好!
1) 1)我正在使用序列发生器0、但我循环遍历每个序列发生器。
2)我已经注释掉除了在 PK3采样之外的所有代码,不起作用。
3) 3)更改订单未解决问题。
4) 4)我刚刚在两块 LaunchPad 上尝试过、它的行为与在我的定制板上的行为相同。
5) 说实话,我不能让端口 K 上的任何 ADC 正常工作。 我尝试在定制电路板和 LaunchPad 上使用项目代码以及 CCS 中的"adcsinglechannel"示例。 如果我使用另一个端口、它会按预期运行。
我有点怀疑,我似乎不能让 PK0-PK3发挥作用。 我是否需要进行一些特殊的配置才能解锁此端口? 我在勘误表中未看到任何内容。
当然可以。 我简化了 adcsinglechchannel 示例,使它更容易看一眼(行为仍然存在)。
#include <stdint.h>
#include <stddef.h>
#include <ti/drivers/ADC.h>
#include <ti/display/Display.h>
#include "ti_drivers_config.h"
void *mainThread(void *arg0)
{
ADC_init();
Display_init();
Display_Handle display = Display_open(Display_Type_UART, NULL);
if (display == NULL)
{
while (1);
}
ADC_Handle adc;
ADC_Params params;
ADC_Params_init(¶ms);
adc = ADC_open(CONFIG_ADC_0, ¶ms);
if (adc == NULL)
{
Display_printf(display, 0, 0, "Error initializing CONFIG_ADC_0\n");
while (1);
}
uint16_t adc_raw;
bool live = true;
while (live == true)
{
int_fast16_t res = ADC_convert(adc, &adc_raw);
if (res == ADC_STATUS_SUCCESS)
{
uint32_t adc_uv = ADC_convertToMicroVolts(adc, adc_raw);
Display_printf(display, 0, 0, "ADC raw result: %d\n", adc_raw);
Display_printf(display, 0, 0, "ADC convert result: %d uV\n", adc_uv);
}
sleep(1);
}
ADC_close(adc);
return (NULL);
}

我对 nortos 应用程序不是特别熟悉、所以如果我配置的示例不正确、请原谅我。 我已经附上了代码、监测 PK3的示波器的屏幕截图和从 LaunchPad 接收的 UART 输出。
/* DriverLib Includes */
#include <ti/devices/msp432e4/driverlib/driverlib.h>
/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>
/* Display Include via console */
#include "uartstdio.h"
void ConfigureUART(uint32_t systemClock)
{
/* Enable the clock to GPIO port A and UART 0 */
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
/* Configure the GPIO Port A for UART 0 */
MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
MAP_GPIOPinConfigure(GPIO_PA1_U0TX);
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
/* Configure the UART for 115200 bps 8-N-1 format */
UARTStdioConfig(0, 115200, systemClock);
}
int main(void)
{
uint32_t getADCValue[1];
uint32_t systemClock;
/* Configure the system clock for 120 MHz */
systemClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),
120000000);
/* Initialize serial console */
ConfigureUART(systemClock);
/* Enable the clock to GPIO Port E and wait for it to be ready */
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
while(!(MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOK)))
{
}
/* Configure PE3 as ADC input channel */
MAP_GPIOPinTypeADC(GPIO_PORTK_BASE, GPIO_PIN_3);
/* Enable the clock to ADC-0 and wait for it to be ready */
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
while(!(MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0)))
{
}
/* Configure Sequencer 3 to sample a single analog channel : AIN0 */
MAP_ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE |
ADC_CTL_END);
/* Enable sample sequence 3 with a processor signal trigger. Sequence 3
* will do a single sample when the processor sends a signal to start the
* conversion */
MAP_ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
/* Since sample sequence 3 is now configured, it must be enabled. */
MAP_ADCSequenceEnable(ADC0_BASE, 3);
/* Clear the interrupt status flag. This is done to make sure the
* interrupt flag is cleared before we sample. */
MAP_ADCIntClear(ADC0_BASE, 3);
/* Sample AIN0 forever. Display the value on the console. */
while(1)
{
/* Trigger the ADC conversion. */
MAP_ADCProcessorTrigger(ADC0_BASE, 3);
/* Wait for conversion to be completed. */
while(!MAP_ADCIntStatus(ADC0_BASE, 3, false))
{
}
/* Clear the ADC interrupt flag. */
MAP_ADCIntClear(ADC0_BASE, 3);
/* Read ADC Value. */
MAP_ADCSequenceDataGet(ADC0_BASE, 3, getADCValue);
/* Display the AIN0 (PE3) digital value on the console. */
UARTprintf("AIN0 = %4d\r", getADCValue[0]);
/* Delay the next sampling */
MAP_SysCtlDelay(systemClock / 12);
}
}

在下面的行中、您需要更改为 ADC_CTL_CH19、即 PK3。 另请在 PE3/PE2或 PK2/PK1等其他通道上进行尝试、以获得良好的比较参考。
/*将序列发生器3配置为对单个模拟通道进行采样:AIN0 */
MAP_ADCSequenceStepConfigure (ADC0_BASE、3、0、ADC_CTL_CH19 | ADC_CTL_IE |
ADC_CTL_END);
Daniel、您好!
这在中似乎是一个已知问题。 以下文章中的 Chris Sterzik 附加了该 解决方法。
早上好!
我似乎仍然无法获得 Chris Sterzik 的权变措施来正确构建。 能否看到您是否能够将他的项目正确构建以进行健全性检查?
此外、 我一直在将 Chris Sterzik 的权变措施与我系统上 simplelink msp432e4 SDK 驱动程序文件中包含的权变措施进行比较。 是否似乎在某个时候将在变通办法中所做的更改 Sterzik 添加到了 SDK 中?
例如、他的文件 ADCBufMSP432E4.h 中的第249行在 ADCBufMSP432E4.h 中的 simplelink sdk 中的307行实现。 我还在第64行看到他对 ADCBufMSP432E4.c 的编辑已 在第49行随附了我的 SDK 的 ADCBufMSP432E4.c。
我能找到的唯一真正区别是 第152行中的变通办法 MSP_EXP432E401y.c。 我已经尝试将其添加到我的项目中、但似乎没有修复行为。
如有任何帮助或指导、将不胜感激。
Daniel、您好!
我希望能够提供更好的指导、但我自己不熟悉 MSP432E SimpleLink 的错综复杂之处。 我发现 C:\ti\simplelink_msp432e4_SDK_4_20_00_12\source\ti\drivers\adc 中文件的两个非缓冲版本的更改与缓冲版本不同。 我认为更改后重新构建库会更容易。 此链接提供有关如何重新构建库的说明。 https://dev.ti.com/tirex/explore/content/simplelink_msp432p4_sdk_3_40_01_02/docs/simplelink_mcu_sdk/Users_Guide.html#rebuilding-drivers。
