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.

MCU-PLUS-SDK-AM243X: VTM temperature reading

Part Number: MCU-PLUS-SDK-AM243X

Hello,

I'm trying to read out the temperature data using VTM module. By using the example code I'm getting a constant value for every instance. And the value is pretty high (perhaps unrealistic ?).

Could you give example to read out data correctly please? 

I have attached the code block that I'm using to read the data

    int32_t          temp_milli_degrees_read;
    int32_t          status;
    SDL_VTM_adc_code adc_code_read;
    SDL_VTM_Stat_val statusVal;

    SDL_VTM_Stat_read_ctrl readCtrl = SDL_VTM_TS_READ_DATA_OUT_VAL;

    SDL_VTM_configTs cfgTs;
    cfgTs.tsCtrl_cfg.valid_map = SDL_VTM_TS_CTRL_MODE_VALID;
    cfgTs.tsCtrl_cfg.maxt_outrg_alert_en = 0;
    cfgTs.tsCtrl_cfg.tsReset = 0;
    cfgTs.tsCtrl_cfg.adc_stat = 0;
    cfgTs.tsCtrl_cfg.mode = SDL_VTM_TS_CTRL_CONTINUOUS_MODE;
    cfgTs.configTsCtrl = SDL_VTM_VD_CONFIG_CTRL_SET_CTL;
    
        for (size_t i = 0; i < 8; i++)
    {
        status = SDL_VTM_initTs(static_cast<SDL_VTM_InstTs>(i), &cfgTs);
        platformLog("Init temperature instance :    %d\r\n"
                    "Status :                       %d\r\n",
                    static_cast<SDL_VTM_InstTs>(i), status);
        if (status == SDL_PASS)
        {
            status = SDL_VTM_getSensorStatus(static_cast<SDL_VTM_InstTs>(i), &readCtrl, &statusVal);
            adc_code_read = statusVal.data_out;
            SDL_VTM_tsConvADCToTemp(adc_code_read,static_cast<SDL_VTM_InstTs>(i), &temp_milli_degrees_read);
            platformLog("Init temperature instance :    %d\r\n"
                        "Status :                       %d\r\n"
                        "ADC code :                     %d\r\n"
                        "Read out data :                %d\r\n",
                        static_cast<SDL_VTM_InstTs>(i), status, adc_code_read, temp_milli_degrees_read);
        }
    

and the output is following:

Init temperature instance :    0
Status :                       0
Init temperature instance :    0
Status :                       0
ADC code :                     1008
Read out data :                155998
Init temperature instance :    1
Status :                       0
Init temperature instance :    1
Status :                       0
ADC code :                     881
Read out data :                144067
Init temperature instance :    2
Status :                       0
Init temperature instance :    2
Status :                       0
ADC code :                     152
Read out data :                3326
Init temperature instance :    3
Status :                       0
Init temperature instance :    3
Status :                       0
ADC code :                     246
Read out data :                28385
Init temperature instance :    4
Status :                       0
Init temperature instance :    4
Status :                       0
ADC code :                     152
Read out data :                3326
Init temperature instance :    5
Status :                       0
Init temperature instance :    5
Status :                       0
ADC code :                     153
Read out data :                3604
Init temperature instance :    6
Status :                       0
Init temperature instance :    6
Status :                       0
ADC code :                     246
Read out data :                28385
Init temperature instance :    7
Status :                       0
Init temperature instance :    7
Status :                       0
ADC code :                     176
Read out data :                9919