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.
Tool/software: Code Composer Studio
While going thru CCS help, I found an error in the "SimpleLink MCU SDK Driver API Reference" but I don't know where to report this error.
This error wasted time for me debugging, so I would like to forward this to the correct department so that others don't run into the same issue.
In the CCS menu, select:
View / Resource Explorer
In Resource Explorer, expand:
Software
--SimpleLink MSP432P4 SDK - v:2.40.00.11
----Documents
------TI Drivers
--------TI Drivers Runtime APIs (doxygen)
This brings up the "SimpleLink MCU SDK Driver API Reference"
Scroll down to the first table listed, select:
ADCBuf.h (under the Driver Interfaces column)
Scroll down to the section marked: "Making a conversion". You will find sample code as follows:
ADCBuf_Conversion blockingConversion; blockingConversion.arg = NULL; blockingConversion.adcChannel = Board_ADCBUF0CHANNEL0; blockingConversion.sampleBuffer = sampleBufferOnePtr; blockingConversion.sampleBufferTwo = NULL; blockingConversion.samplesRequestedCount = ADCBUFFERSIZE; if (!ADCBuf_convert(adcBuf, &continuousConversion, 1)) { // handle error }
The "if" statement is wrong in two ways:
1) The variable name continuousConversion should be blockingConversion
2) The result is defined as ADCBuf_STATUS_SUCCESS or ADCBuf_STATUS_ERROR, not as zero / non-zero.
THE PROBLEM:
ADCBuf_STATUS_SUCCESS is currently defined as zero.
This means the "// handle error" code will be executed on a successful conversion !!!
This makes the if's response backwards.
Also, using "!" is bad usage (in this case) since the documentation for ADCBuf_convert clearly states it returns ADCBuf_STATUS_SUCCESS or ADCBuf_STATUS_ERROR - not zero / non-zero.
To be consistent with ADC_convert (in ADC.h), it should be rewritten as:
if (ADCBuf_convert(adcBuf, &blockingConversion, 1) == ADCBuf_STATUS_SUCCESS) {
// use blockingConversion
}