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.

RTOS/MSP432P401R: ADC adcbuf & DMA multi channel enabling problem

Part Number: MSP432P401R

Tool/software: TI-RTOS

Hello I am currently developing on MSP432P401R MCU using CCS 8.1 and simplelink_msp432p4_sdk_2_20_00_12 SDK in TI-RTOS.

My goal is to obtain 5 channel ADC with 100ksps in each channel continuously and check through the datas in the completed adc buffers at adcBufCallback. I have started with the "drivers" example "adcbufcontinuous" and "adcbufmultichannel".

From simplelink academy "SimpleLink SDK - Precision ADC: 1MSPS Sampling Rate on the MSP432P4" and "adcbufcontinuous" example, I followed to obtain up to 1 MSPS for single channel ADC with DMA on.

With "adcbufmultichannel" example, I managed to open 5 channel ADC in ADCBUF0. (Using 5 channel in one ADC)

Q1: When opening multiple channel in single ADC, do I have to multiply number of channels for the "adcBufParams.samplingFrequency" ?

For example, if I want to achieve 100 KSPS for 5 channels, do I put in 500,000 for the sampling frequency value? But when I measured the actual sampling frequency using function generator, I realized that the sampling frequency did not increase over 60 KSPS for each channel no matter how high I put in the value for "adcBufParams.samplingFrequency" . (even if I put in 1,000,000 which is maximum) Also the number of opened channels did not change the result. (enabling 2ch, 3ch, 4ch, 5ch, they all had maximum actual sampling frequency at 60 KSPS)

I was looking over the whole code and I realized in MSP_EXP432P401R.c, "ADCBufMSP432_HWAttrs adcbufMSP432HWAttrs[MSP_EXP432P401R_ADCBUFCOUNT]" the DMA was not enabled for the "adcbufmultichannel".

So when I enabled DMA by changing ".useDMA = 0," to ".useDMA = 1,", I found that only the first channel was working (at 100 KSPS same as input) and the other four channels were not working. Looking through the MSP_EXP432P401R.c and the MSP432 data sheet, technical data sheet, I cannot seem to figure out how to enable 5 or multiple channels of DMA.

Q2: In this case, where 5 channel in single ADC is opened, is it possible to enable 5 channel of DMA for each ADC channel to enable higher sampling frequency?

If not, what other way is there to enable multiple channel of ADC at 100 KSPS? (I am using 1000 datas for each buffer, ADCBUFFERSIZE=1000)

Besides the ADC thread, I am also trying to enable separate thread with BME280 temperature/humidity sensor (using Sensor BoosterPack and sail_1_20_00_02 SDK).  I am trying to use the "i2cbme280_MSP_EXP432P401R_tirtos" example to obtain temperature and humidity data. When using CCS 8.1 with simplelink_msp432p4_sdk_2_20_00_12 SDK, the example itself shows #10010 null error when builded with Description Resource Path Location Type cannot find file "C:/ti/simplelink_msp432p4_sdk_2_20_00_12/source/third_party/fatfs/lib/fatfs.aem4f" null: cannot find file "C:/ti/simplelink_msp432p4_sdk_2_20_00_12/source/third_party/fatfs/lib/fatfs.aem4f" i2cbme280_MSP_EXP432P401R_tirtos_ccs C/C++ Problem

When using CCS 7.4 with simplelink_msp432p4_sdk_1_60_00_12 SDK, it builds fine and the data is obtained.

But for both CCS and both MSP432 SDK, when I copy the bme280 c file and change the appropriate board.h settings and create additional thread in main_tirtos, I always end up with #10234-D null: unresolved symbols remain with folloing 19 errors of bme280_support.obj such as

"Description Resource Path Location Type unresolved symbol bme280_compensate_humidity_int32, first referenced in ./bme280_support.obj adcbufmultichannel_MSP432_bme280 C/C++ Problem"

So my question is:

Q3: Is there a simpler example or way to add BME280 thread such as the example of simplelink "A Multi-threaded RTOS Thermostat"?

I cannot seem to figure out what the above error is because the error only shows when I enable the new thread and the error itself does not show inside the code. 

I looked over almost every example or ti e2e forum questions or ti pdfs to solve the above questions but I cannot seem to solve it by myself. If my description lacks detail or if I need to upload the needed code please let me know. Also I am fairly new to MCU and TI RTOS environment so any comment/ guidelines would be really helpful. 

Best regards.

  • Q1: When opening multiple channel in single ADC, do I have to multiply number of channels for the "adcBufParams.samplingFrequency" ?

      A1. Yes, the sampling frequency given is per-sample. It's not a collective (multi-channel) number.

    Q2: In this case, where 5 channel in single ADC is opened, is it possible to enable 5 channel of DMA for each ADC channel to enable higher sampling frequency?

      A2. Using 5 DMA channels won't increase the sampling frequency. I think what you are trying to do is cycle through the 5 ADC channels as fast as you can, no? As I mentioned above in Q1, you would need to increase the sampling frequency given to the ADCBuf configuration, and set it up for continuous/repeated sampling.

    If not, what other way is there to enable multiple channel of ADC at 100 KSPS? (I am using 1000 datas for each buffer, ADCBUFFERSIZE=1000)

    Q3: Is there a simpler example or way to add BME280 thread such as the example of simplelink "A Multi-threaded RTOS Thermostat"?

    I cannot seem to figure out what the above error is because the error only shows when I enable the new thread and the error itself does not show inside the code. 

      A3. If you follow the coding style of the thermostat example that you mentioned, you shouldn't have any issues. The error you refer to suggests that you have not properly defined that variable so that it exists in all the contexts you are trying to use it in. Please post the example code if you'd like more feedback.

    -Bob L.

  • Q1: Thank you for the reply. That makes sense. I did check it with experiments but I needed a definite answer. Thank you.

    Q2: Increasing the total sampling frequency does increase the sampling frequency of each channel.. but only up to a certain sampling frequency without DMA. As I mentioned in the first question, each channel's sampling frequency does not exceed 60 kHz no matter how high I put in for the sampling frequency. (even 1 MSPS)

    Also, if you look at the TI simplelink example, "SimpleLink SDK - Precision ADC: 1MSPS Sampling Rate on the MSP432P4", it also clearly states that without DMA for single channel ADCBUF, only 100 KSPS works. In order to achieve 500 KSPS and 1 MSPS it states that DMA is needed.

    This explains where 5 channel ADC without DMA has about 60 KSPS bottleneck (maximum total sampling frequency around 300 KSPS).

    I also personally tried with adcbufcontinuous example and adcmultichannel example without DMA and they all cannot reach total 500 KSPS.

    So is there way to enable multichannel DMA when trying to use it with ADCBUF and ADC multiple channel? Because to my understanding, enabling each ADC channel with DMA seems to be the only possible way to achieve 100 KSPS for 5 channels each.
  • In order to measure a sequence of channels and then move the data with the DMA, then the scatter-gather implementation of the DMA would be required. This is because you would need the source address to auto-increment only 5 times and then restart while the destination would continue to increment until the number of samples were collected. The current implementation in the ADC drivers only supports the basic and ping-pong modes of the DMA.


    Here are some non-TIRTOS examples with the DMA.

    e2e.ti.com/.../612768
    e2e.ti.com/.../722600

    Regards,
    Chris

**Attention** This is a public forum