In the MCSDK middleware is are the Observer bemf samples accessible ?
Hi All,
I'm working on a motor control system where I need access to the firmware bemf observer values for alpha and beta. Is this available in the middleware or MCSDK library? Can someone point me to documentation if it is available?
Edit:
Adding to this question, in mc_tasks.c in procedure __weak uint8_t TSK_HighFrequencyTask(void) I added the following: (value is declared static uint32_t (near line #736):
/* USER CODE BEGIN HighFrequencyTask SINGLEDRIVE_3 */
value = STO_PLL_GetEstimatedBemfLevel( (&STO_PLL_M1) );
HAL_DAC_SetValue( &hdac1, (uint32_t) DAC_CHANNEL_2, (uint32_t) DAC_ALIGN_12B_R, (uint32_t) value);
/* USER CODE END HighFrequencyTask SINGLEDRIVE_3 */My setup of DAC1_CH2 in MX_Dac1_Init is the following:
/** DAC channel OUT2 config
*/
sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_EXTERNAL;
sConfig.DAC_SampleAndHold = DAC_SAMPLEANDHOLD_ENABLE;
if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_2) != HAL_OK)
{
Error_Handler();
}The actual DAC output 'resembles' what I expect (a 0.5V sinewave at 200Hz) but it has spikes every period of the motor PWM frequency.

- Is STO_PLL_GetEstimatedBemfLevel the correct method to access the BEMF Oberver value?
- Is TSK_HighFrequencyTask() the correct place to access the Observer value?
- Is the DAC set up incorrectly?
I don't know if the value I'm retrieving is wrong or if my use of the DAC for output is wrong.