cancel
Showing results for 
Search instead for 
Did you mean: 

Second NTC_Handle_t type sensor

ketchup
Associate III

uC = STSPIN32G4

second sensor = PA4 (ADC2_IN17)

I have tried add second NTC sensor and using MC functions.

A have added:

sConfig.Channel = ADC_CHANNEL_17; // BEARING_TEMPERATURE
 sConfig.Rank = ADC_REGULAR_RANK_1;
 sConfig.SamplingTime = ADC_SAMPLETIME_47CYCLES_5;
 sConfig.SingleDiff = ADC_SINGLE_ENDED;
 sConfig.OffsetNumber = ADC_OFFSET_NONE;
 sConfig.Offset = 0;
 if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
 {
  Error_Handler();
 }

to MX_ADC2_Init.

I defined :

NTC_Handle_t Temp2Sensor_M1 =
{
  .bSensorType = REAL_SENSOR,
  .TempRegConv =
  {
    .regADC = ADC2,
    .channel = MC_ADC_CHANNEL_17,
    .samplingTime = M1_TEMP_SAMPLING_TIME,
  },
  .hLowPassFilterBW        = M1_TEMP_SW_FILTER_BW_FACTOR,
  .hOverTempThreshold      = (uint16_t)(OV_TEMPERATURE_THRESHOLD_d),
  .hOverTempDeactThreshold = (uint16_t)(OV_TEMPERATURE_THRESHOLD_d - OV_TEMPERATURE_HYSTERESIS_d),
  .hSensitivity            = (uint16_t)(ADC_REFERENCE_VOLTAGE/dV_dT),
  .wV0                     = (uint16_t)(V0_V *65536/ ADC_REFERENCE_VOLTAGE),
  .hT0                     = T0_C,
};

and in main :

NTC_Init(&Temp2Sensor_M1);

Nothing happens... Do You know what I can do next?

Even is it posiible to use diffrerent /anotherADC to RCM_RegisterRegConv() function?

Kind regards

�?ukasz �?ęcki

1 REPLY 1
GMA
ST Employee

Hello,

Firstly, we would like to sincerely apologize for the delay in replying to your post.
If your point is still pertinent, please consider using MCSDK6.2 WorkBench, you will be able to directly edit a board description .json file (starting from an existing one using STMC Board Manager) in order to add your new temperature measurement input as below:
"TEMPERATURE_NTC": [
  {
    "name": "PC4",
    "help": "",
    "cost": 0
  },
  {
    "name": "PA4",
    "help": "",
    "cost": 0
  }
Starting a new project with this modified board description, motor control workbench will give you the input choice and will generate the project accordingly.

GMA_0-1700057794563.png

 

 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA