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.

LAUNCHXL-CC26X2R1: adcsinglechannel doesn't receive signals correctly

Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: SYSCONFIG, CC2642R, CC2652R,

Tool/software:

Hi TI Engineer,

I am currently trying to use the ADC function in the example from C:\ti\simplelink_cc13xx_cc26xx_sdk_7_40_00_77\examples\rtos\CC26X2R1_LAUNCHXL\drivers\adcsinglechannel. I aim to receive signals from a signal generator and output them as charts using MATLAB. The inputs I have tried are sine waves and square waves, but the received signals are essentially garbled and do not resemble any recognizable waveforms. I have already confirmed that the signal generator is functioning correctly, as another component can receive the signals correctly.

I will attach an image of the output below. Additionally, what confuses me is that when I connect DIO24 to the 3V3 pin, I can read a steady 3V3 signal. Does this indicate that the launchpad is functioning correctly? Or did I make a mistake in selecting the pin? I chose DIO24 and the GND on the top right. Or is there another coding issue I haven't considered? The code has basically not been modified, as I just want to test if the ADC functionality can work (UART functionality is operating correctly).

Please let me know if I need to provide the code. Thank you.

  • Hi,

    What is the frequency of the signal generator waveforms?  Please note that the default Sampling Duration in SysConfig -> TI DRIVERS -> ADC is 2.7 us (~370 kHz) and also the lowest available for the ADC TI Driver.  If your signal significantly fluctuates during this sampling time then results will be distorted.  Also, is your signal generator outputting a waveform between 0 and 3.3 V?  This is the only allowable range for the CC2642R, and negative rails or higher voltages will also contort the measurements.  Such metrics are documented in the Datasheet.

    If the raw ADC values appear to be fine after further debugging and investigation, then we should further consider the transport layer and conversions between the CC2652R and Matlab.

    Regards,
    Ryan

  • Hi,

    Thank you for your reply. Regarding the frequency of the signal generator, the square wave is between 0.125-2 Hz, with an amplitude of 0.5-5 mV. The sine wave is between 0.1-100 Hz, with the same amplitude of 0.5-5 mV. Additionally, can the sampling time of the ADC only be adjusted in SysConfig? I didn't see any section for adjusting the sampling frequency in main_rtos.c.

    Regards,

  • The frequency shouldn't be an issue, but the amplitude doesn't utilize even 0.2% of the allowable ADC range.  A 12-bit ADC with range of 0 to 4.3 V will return a value of 4 for a 5 mV input, Output = Input (V) * 2^12 / (ADC range (V)) = .005*4096/4.3, ADCCC26XX.h. Thus, please amplify your signal generator voltage before providing it to the CC2652R input pin.

    I provided a description of what all is required for adjusting the ADC sampling frequency dynamically in this relevant E2E post.

    Regards,
    Ryan

  • So, the reason why the raw data received by the launchpad is almost 0 is that the voltage supplied by the signal generator is too low, correct?
    Then why does the converted data fluctuate dramatically?
    So the current solution is to test whether an external signal amplifier between the signal generator and the launchpad can correctly receive the signal. The maximum output of my signal generator is 5 mV, what is the appropriate amplification factor? Should the signal input frequency and the launchpad's sample duration be matched? Can such adjustments be made in SysConfig?
    What is the difference between using the sensor controller's ADC and directly using the ADC?

    Regards

  • Then why does the converted data fluctuate dramatically?

    That will depend on the stability of the signal generator output and data type conversions for the UART transport.  For example, oscilloscope screenshots must confirm an unexpected raw/converted result as directly reported by the CC2652R1.

    The maximum output of my signal generator is 5 mV, what is the appropriate amplification factor?

    3.3 V / 5 mV = 660, this is the amplification range you have to work with.

    Should the signal input frequency and the launchpad's sample duration be matched?

    No, the LP's sample duration should be significantly less than the signal input frequency to adequately capture the signal generator's current waveform state.

    Can such adjustments be made in SysConfig?

    These are compile-time changes.

    What is the difference between using the sensor controller's ADC and directly using the ADC?

    The Sensor Controller has a separate processor, controlled and enabled through Sensor Controller Studio, for taking ADC measurements without waking the main CPU.  This should affect power consumption measurements but not ADC resolution or accuracy.

    Regards,
    Ryan

  • Hi,

    First, thank you very much for your assistance. After using another signal generator with an input of 1V, we successfully received the square wave signal from the ADC.

    However, when observing the MATLAB plot, we noticed that there seems to be a delay in rendering the chart. The speed at which MATLAB plots the data is significantly slower than the output frequency of the signal generator, which is set to 1 and 10 Hz.

    Could this be due to the excessive number of sampling points, causing MATLAB to struggle with processing the collected signals, or is there another reason?

    How should we address this issue?

    Additionally, our goal is to use the CC2642R to complete the data transmission from Sensor -> CC2642R (via ADC) -> UART/BLE -> mobile phone/PC. Is the allowable ADC range for the CC2642R the same as that for the LaunchPad?

    In the CC2642R datasheet, the section describing "Voltage scaling enabled/disable" is a bit confusing to me. Could you please explain what this means?

    Regards

  • How often are you attempting to send UART packets?  You shouldn't need to ADC sample and UART send more than once every 10 ms to achieve an accurate reading of a 10 Hz signal.  You can use a timer or sleep delays to achieve this effect.  You can also increase the UART baud rate to at least 921600 to reduce transfer delays.

    The ADC is the exact same for the CC2642R as with the CC2652R on the LAUNCHXL-CC26X2R1.

    Voltage scaling is described in both ADCCC26XX.h and the TRM.  "By default, the input is scaled down internally by a factor of 1408 / 4095 before it is used in the ADC. It is possible to disable down-scaling of the ADC input for increased resolution at the cost of reduced input range."

    Regards,
    Ryan