Part Number: SIMPLELINK-MSP432-SDK
Let's assume i have a configuration for the ADCBuf like mine, where the ADCChannel are mixedup and not sorted from 0 to 31.
Also, there are many analog inputs left for the channel configuration.
ADCBufMSP432_Channels adcBuf0MSP432Channels[MSP_EXP432P401R_ADCBUF0CHANNELCOUNT] = {
{
.adcPin = ADCBufMSP432_P4_0_A13,
.refSource = ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS,
.refVoltage = 2500000
},
{
.adcPin = ADCBufMSP432_P5_3_A2,
.refSource = ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS,
.refVoltage = 1450000
},
{
.adcPin = ADCBufMSP432_P5_1_A4,
.refSource = ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS,
.refVoltage = 1450000
},
{
.adcPin = ADCBufMSP432_P5_2_A3,
.refSource = ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS,
.refVoltage = 1450000
},
{
.adcPin = ADCBufMSP432_P4_0_A13,
.refSource = ADCBufMSP432_VREFPOS_INTBUF_VREFNEG_VSS,
.refVoltage = 1450000
}
};
So if I am using the ADCBufChannel0 which is referred to the analog port A13 for the mux on Port 4.0.
The pin will be set as expected, but the selection of the analog input for the multiplexer not.
I found the code part where it fails to configure the analog port for the given channel.
MAP_ADC14_configureConversionMemory(ADC_MEM0,
refSource,
conversions->adcChannel, false);
channelInt = ADC_INT0;
Normal the pin configuration is like:
#define ADCBufMSP432_P4_0_A13 ((13 << 10) | 0x0340) /* ch 13, port 4, pin 0 */
So the analog input information is stored 10 bits above the pin configuration.
so i added a single line which now extract this information and give this to the conversion configuration.
uint8_t adcChannel = (hwAttrs->channelSetting[conversions->adcChannel].adcPin >> 10);
MAP_ADC14_configureConversionMemory(ADC_MEM0,
refSource,
adcChannel, false);
channelInt = ADC_INT0;
Let me know if I am wrong with my fix but otherwise i have to list all adcports until this one which i want do use.
Bests
Richard