OK so when building a real FB circuit i hit a real WALL: i dont understand ho it works :'( .
Regardless if it is at 1A load or 5A load Voltage at comp in is about .9V and the current through the FB diode is about the same.
Worst of all i have no idea how you set it all up on the primary side , on the secondary i sort of understand the standard circuit .
Well datasheet is also not great from what i understand 1mA corresponds to 0% duty cycle but no data on that is 100% duty cycle
Could you please demystify the FB for me
The datasheet is fairly transparent regarding this, see the functional block diagram, and section 7.3.8:
The COMP current is fed to a current mirror, the output of which connects to the 5V REF via a 5K resistor. In the subcircuit, this is node COMPI. So this voltage will be V(COMPI) = 5-1000*I(COMP).
COMPI is is also clamped by the SS pin voltage, so in reality you get V(COMPI) = min(V(SS), 5-1000*I(COMP)).
Some more circuitry then reduces COMPI, first by subtracting 1V from it, then cutting it in half with a resistor divider. The result (node COMP2PWM in the model) is what is applied to the inverting input of the PWM comparator. The noninverting input to this comparator is the RAMP pin, which comes from your current sensor. Basically, power will be delivered to the transformer until V(RAMP) = V(COMP2PWM). Or, putting all those equations, V(RAMP) = (min(V(SS), 5-1000*I(COMP)) - 1.0)/2. This all may look bizarre, but I've seen the same sort of circuitry used in many PWM converters.
One thing to keep in mind is that the datasheet describes ways to use the chip for pure voltage-mode control (I(COMP) directly controls duty cycle) or current-mode (I(COMP) controls peak transformer current). Which control mode is used depends on how the RAMP pin is connected.
In the case where the RAMP pin is connected to a sawtooth waveform with constant slope (i.e. from the SLOPE pin, not from your current sensor), then you end up with is pure voltage-mode control. Figure 17 also shows a way to generate the ramp from Vin, which provides some useful feedforward compensation (but it's still voltage-mode).
In the case where the ramp pin is only connected to your current sensor (no connection to the SLOPE pin), then you instead end up with simple peak current-mode control.
However, with current mode control you will run into subharmonic oscillations when operating at duty cycles above 50% (in continuous conduction mode, that is). The fix for this is to inject some fixed sawtooth waveform into the current-sense signal. This is shown in fig 11 of the datasheet. Basically what you end up with is a combination between pure current mode and pure voltage mode control. The higher the duty cycle you operate at, the stronger your slope compensation must be. The stronger the slope compensation, the stronger the influence of the voltage-mode control. This was one of the reasons I was suggesting you change turns ratio, so that you don't have to operate near 100% duty cycle.
Also, these tradeoffs are not something particular to the LM5046, or to this SPICE model. Same thing will apply to 99% of PWM controllers (excepting some that use very esoteric control schemes).