I have found two things for the controller part
this page have a detailed tutorial on the passives and workings, also it has a very simple control algorithm
https://sudonull.com/post/7101-Development-of-buck-converter-on-STM32F334-principle-of-operation-calculations-prototypingvoid ADC1_2_IRQHandler (void) {
ADC2->ISR |= ADC_ISR_EOC;
adcResult = ADC2->DR;
if (adcResult > 2480) {
dutyControl = dutyControl - 10;
}
else
{
dutyControl = dutyControl + 10;
}
SetDutyTimerA(dutyControl);
}
And I have found this very nice app note from infenion AP32319, which uses Biricha WDS tool to calculate controller params,they use 3 pole and 3 zeros for voltage loop
__STATIC_INLINE void XMC_3P3Z_FilterFixed( XMC_3P3Z_DATA_FIXED_t* ptr )
{
int32_t acc;
// acc (iq9.22) = An (iq-1.19) * Un (iq(8.8)
acc = ptr->m_A[3]*ptr->m_U[2]; ptr->m_U[2] = ptr->m_U[1];
acc += ptr->m_A[2]*ptr->m_U[1]; ptr->m_U[1] = ptr->m_U[0];
acc += ptr->m_A[1]*ptr->m_U[0];
acc = acc >> ptr->m_AShift; //iq is now iq9.19
// acc (iq12.19) = Bn (iq1.14) * En (iq(12.0)
acc += ptr->m_B[3]*ptr->m_E[2]; ptr->m_E[2] = ptr->m_E[1];
acc += ptr->m_B[2]*ptr->m_E[1]; ptr->m_E[1] = ptr->m_E[0];
acc += ptr->m_B[1]*ptr->m_E[0]; ptr->m_E[0] = ptr->m_Ref-((uint16_t)*ptr->m_pFeedBack);
acc += ptr->m_B[0]*ptr->m_E[0];
//our number is now a iq12.19, but we need to store U as a iq8.8
acc = acc >> ptr->m_BShift; //now it’s a iq12.8
acc = MIN( acc , ptr->m_KpwmMax );
acc = MAX( acc , ptr->m_KpwmMaxNeg ); //now it’s a iq8.8
ptr->m_U[0] = acc;
acc = acc >> ptr->m_OShift; //now it’s a iq8.0
if ( acc < ptr->m_KpwmMin) acc = ptr->m_KpwmMin;
ptr->m_pOut = acc;
}
void ISR_voltage_control_loop()
{
/* Applying the filter to the ADC measured value */
XMC_3P3Z_FilterFixed(&ctrlFixed);
/* Updating the compare value 1 of the CCU8 */
PWM_CCU8_0.ccu8_slice_ptr->CR1S = ctrlFixed.m_pOut;
/* Enabling shadow transfer */
PWM_CCU8_0.ccu8_module_ptr->GCSS= 0x1;
}
In the infenion app note they have also covered current loop control, so here is the questions
the WDS tool is fantastic, have you used it? Is there a very cheap way to convert the high-side current sense for the op-amp of padauk? also we have a simple 8-bit padauk, which control algorithm do you suggest? and if you prefer doing it with other hardware, what's your preferred way of controlling it,do you have any info and tutorial on your way of doing it?