Author Topic: B3603 DC/DC Buck Converter mini review and how the SET key could be fatal...  (Read 171697 times)

0 Members and 1 Guest are viewing this topic.

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
To know if it is locked you try to read it. You hook it up with the SWIM connector (I soldered a connector at the bottom pins) and use an STLinkV2 device to read it (either Linux stm8flash or the Windows STVP), I so far only tried one unit and it was locked out. I have another one but need to solder the header to it first. I suspect they are all going to be locked out, it seems like a trivial step at the mfg process that I can't think it will be missed in some batches.

But feel free to try it out and report if you succeed! It would be really nice to see what they do in there and be able to improve on it rather than start from scratch as I currently do.
 

Offline neslekkim

  • Super Contributor
  • ***
  • Posts: 1305
  • Country: no
The four pins next to the buttons?
cool, will try that, have both the clone stlinkv2 and the original stlinkv2, going to try to find all my units, I have atleast two of them, and one more in the post, ordered from dx, banggood, and some ebay sellers.
 

Offline flex

  • Contributor
  • Posts: 25
I just drew the schematic of the bottom board.  ;D
(Please report any error...)

Update 1: forgot C8 (attachment updated)
Update 2: Added IN- to GND wire
Update 3: Now the resisor value don't use the smd codes anymore
Update 4: Clarify schematic. Use VCC instead of pin 14
Update 5: Reorder and add some more labels to clarify
Update 6: enhance readibility, correct some groups
Update 7: Top board. See newer post.
« Last Edit: February 19, 2015, 01:01:41 am by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
I just drew the circuit of the bottom board.  ;D
(Please report any error...)

Amazing!

I wonder how the voltage to the top board stays constant when the out+ changes, the schematics shows a voltage divider from what I understand and nothing more. The top board always gets about 5V.

Any ideas about the resistor values? What about the voltage divider for the input? We can find it empirically but getting a sense for the voltage divider values would be a nice validation.

I'm collating all of the information on the B3603 in my github repository, I hope it is ok that I take it like that. I'll be sure to give credit for all the work all you folks are doing, I couldn't have progressed so fast without all that information! If you don't want the files/documents added to my git repo just let me know and I'll remove it.
« Last Edit: February 17, 2015, 03:15:42 pm by baruch »
 

Offline flex

  • Contributor
  • Posts: 25
Quote
Any ideas about the resistor values?
I think all resistor values are in my schematic. Or what do you mean?

Quote
I wonder how the voltage to the top board stays constant when the out+ changes
Not sure if I got the question right, but the 5V are provided by the XL1509 DC DC converter.
« Last Edit: February 17, 2015, 03:16:54 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
I'm not experienced with electronics so the numbers on the resistors don't mean much to me, I expected to see 10K, 15K and such values, the numbers on the resistors are in the hundreds. Are these just codes for the actual value?
 

Offline flex

  • Contributor
  • Posts: 25
Quote
Are these just codes for the actual value?
Yes  ;), you might want to google for "smd resistor code"

I just updated the values. They might be easier to read this way. (see orig post)
« Last Edit: February 17, 2015, 03:40:16 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
The input sense voltage divider is made out of a 15K and a 1K resistors so the factor is 0.0625 which is pretty much exactly what bal00 figured out from his work. It's nice to see things get validated between different parts.

One thing though, this doesn't seem to work out when I read the values from the ADC, my factor for my device is 53.67 rather than 62.5, I'm mostly wondering what mistake I made in my code that brought this...
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
Quote
I wonder how the voltage to the top board stays constant when the out+ changes
Not sure if I got the question right, but the 5V are provided by the XL1509 DC DC converter.

I saw that part and it feeds VCC into pin 13 and 14 but there is also an OUT+ part that gets connected to pin 14 and then gets connected to the opamp on the current sense side.
 

Offline flex

  • Contributor
  • Posts: 25
I just modified the schematic to use the power label "VCC" instead of pin 14 to clarify that. But anyway the constant VCC voltage is regulated by XL1509.

Further it looks like the 50m shunt is used to measure the current and is biased by R7, R10. Don't ask me what R18 is doing there, I can't see any reason for it.

Quote
One thing though, this doesn't seem to work out when I read the values from the ADC, my factor for my device is 53.67 rather than 62.5, I'm mostly wondering what mistake I made in my code that brought this...
I yet have to take a look at the code, but be aware that VCC is only approximitly 5V, the real value is 1.23*(1+3/1)=4.92V (just in case you use VCC as reference). I know that this won't explain the your difference.
« Last Edit: February 17, 2015, 04:17:53 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
The MCU indeed uses VCC as reference for all I know. I believe there is a way to measure the Vref with an ADC, I still didn't try that yet. Not sure what to expect from it either.

 

Offline flex

  • Contributor
  • Posts: 25
Just took a look at your ADC problem. I can't see how you derived these formulars in read_state. Maybe you could explain them?

However I found the following in the Reference manual for STM8S and STM8AF microcontroller families:
Code: [Select]
VREF-  This input is bonded to VSSA in devices that have no external VREF- pin
VREF+  This input is bonded to VDDA in devices that have no external VREF+ pin
VSSA   This input is bonded to VSS in devices that have no external VSSA pin
VDDA   This input is bonded to VDD in devices that have no external VDDA pin

That way I would expect 0x00 to be 0V and 0x3ff=1023 be VCC and would do the following calculation to obtain the voltage from the adc value (but I never used the STM8 adc before):
state_vin = val * 62.5 * VCC * / 1023

But I can't test this at the moment, because I only have the preprogrammed STM8 and don't want to erase it (I should order an IC for testing).

Btw. I assume you don't use the "stm8 standard peripheral library" because of the restrictive licensing? Too bad that it isn't BSD licensed as the STM32 HAL and CMSIS libraries.
« Last Edit: February 17, 2015, 06:10:52 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
Just took a look at your ADC problem. I can't see how you derived these formulars in read_state. Maybe you could explain them?

I've used a linear approximation and measured the voltage in at two points and used the ADC output and the measured voltage in  to find the A and B values of the equation Y=A*X+B. I believe I tried initially to use the 62 multiplier and that resulted in wrong numbers.

Quote
That way I would expect 0x00 to be 0V and 0x3ff=1023 be VCC and would do the following calculation to obtain the voltage from the adc value (but I never used the STM8 adc before):
state_vin = val * 62.5 * VCC * / 1023

I get from the ADC the value 167 when I have the input at 8.91, if I use your formulate I get:
167 * 62.5 * 4.92  / 1023 = 50.19

If I drop the 4.92 value I get 10.2

Both of these are wrong (should be 8.91)
 

Offline flex

  • Contributor
  • Posts: 25
 |O I just realized, that my formula has the wrong multiplier (but that won't solve the problem :-DD)

So we have 9.81V Vin => 9.81V/16=0.613V as output of the voltage devider (can you verify that by measuring pin3 to gnd? and could you also measure VCC?)

Now I would calculate adc=0.613V/4.92V*1023=127 (but you got 167, so I'm off the track)

However the formula I meant is:
adc * VCC  / 1023 * 16
(would result into the wrong result: 167 * 4.92  / 1023 * 16 = 12,85V)

Would you mind to post some more samples (Voltage Vin, voltage at pin 3 (voltage divider), measured adc value, vcc)?
« Last Edit: February 17, 2015, 09:02:28 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
It is 8.91V in the numbers above and not 9.81V...

I've switched to try to get the PWM working so the code is currently not safe to run on the full module, I use the top board only for this development part. I'll get back to the ADC once I get the PWM somehow working to get even a semi-fixed voltage output.
 

Offline flex

  • Contributor
  • Posts: 25
I think I found my mistake. VCC is 4.92V of the lower board != voltage of the STM8 at the top board.
I hadn't took a look at the the top board and assumed it would run with 5V, but now I saw the 3.3V ldo.

So I get:
adc * 3.3  / 1023 * 16 = 167 * 3.3  / 1023 * 16 = 8.619V
That is much closer to 8.91V :D (since the devices will be calibrated, this could be in spec ;))

btw: My stm8 is also protected. I'll wait until I'll get another uC (don't want to loose the orig program).

btw2: I just did another schematic update.
« Last Edit: February 18, 2015, 02:37:32 am by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
I'm not quite sure how the current loop works. The input to it is from VCC and OUT-, from the very little I know I've only seen the shunt used on the OUT+ and then the voltage drop across it being measured. I can't figure how this gets done here.

Would appreciate if someone could point me to some reference on the method used here.

EDIT: Looks like the VCC is voltage divided into almost nothing, I still can't understand what it does there. But I still don't understand how comes the opamp input for the current sensor doesn't come between the OUT- and the shunt to measure the voltage drop on the shunt.
« Last Edit: February 18, 2015, 06:59:06 am by baruch »
 

Offline eas

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: us
    • Tech Obsessed
Don't want to distract from this excellent reverse engineering discussion, but I thought people in this thread might be interested in something I stumbled on. I thought I spotted a familiar logo in a fuzzy product listing on ebay. Another photo had a clearer view. It was the MinHe logo, on a 10A switching supply that can do up to 120v. A rather big step up from the 6A sibling of the B3603.
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
It is a big brother to the small ones. It's also priced much higher. The one thing I like about the B3603 is that it's dirt ship at $12 and if I can get serial communication with it I'll have the cheapest programmable power supply that can possibly be :-)
 

Offline flex

  • Contributor
  • Posts: 25
@eas and it is 10 times more expensive ;) but interesting

@baruch
I think I got an idea what is going on with the current regulation:

Obviously there is a voltage Vshunt at the shunt (5mV per 100mA). Lets assume this voltage is constant (R10 is 10k so this isn't too unreasonable).
so the voltage divider divides the voltage (VCC-Vshunt). With VCC=5V we get:
Code: [Select]
I Vshunt Vout to Vshunt
100mA 0,005V 0,0099700599V
1A 0,05V 0,0098802395V
This is a more or less constant 10mV. That way (Vout to GND)=10mV+Vshunt.

That means Vshunt gets an offset of 10mV. This value gets feed into the non inverting amplifier (ingore R18, the input impedance is much higher) and is amplified with the factor 16.

That means we can measure at pin 1 (ignoring R25, R28 because we asssume inf input impedance again):
16*(10mV+Vshunt)=160mV+16*(I*0.05)=160mV+0.8*I
that is reasonable close to bal00 formula: 140mV+0.97*I (There are real world tolerance and I did some idealization, in the calculation)

Now that output gets to the PI-Conroller.

Update: I just did a LTspice simulation to verify the calculation. Looks pretty good (see attachment)
Update: Did a more exact calculation later in the thread
« Last Edit: February 20, 2015, 05:03:49 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
@flex, Thanks for the analysis!

I'm getting some progress on the PWM front.

I found that the total flash area is 2KB so it's going to be a very slim fit and when I switched to a more verbose protocol it made the code bloated with the additional strings. I think I'll need to go back to a slimmed down protocol to save the space for real code and assume a utility from outside to communicate with the unit and make the verbose interface.
 

Offline flex

  • Contributor
  • Posts: 25
2KB is quite limiting. For me a binary protocol would be enough. One could use an interface tool.
Have you tried to use code optimization (--opt-code-size and increasing --max-allocs-per-node)?

Btw, I just updated the schematic again (nothing too major).
« Last Edit: February 18, 2015, 04:13:59 pm by flex »
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
Optimization for code size helped a bit, I also use some floating point calculations to save the time to look up fixed point arithmetics and that is costly in cpu time and flash size and I will need to get rid of it soon. But for now I want to see results faster than I want more features.
 

Offline baruch

  • Regular Contributor
  • *
  • Posts: 78
  • Country: il
I got some basic PWM working but I think I burned my unit somehow, it is not putting any output and when I use another unit to feed it power it says it is current limited even though it didnt get to the current limit. Still no idea which of the units is busted.

I guess I'll try tomorrow with a fresher mind.


EDIT: I couldn't hold off, I switched the heads of my two units and the top-unit is working, the bottom board seems to malfunction. I got the PWM to work to generate voltage, still didn't try to put a load on it.
« Last Edit: February 18, 2015, 07:47:50 pm by baruch »
 

Offline Rick LawTopic starter

  • Super Contributor
  • ***
  • Posts: 3482
  • Country: us
...
The thing I don't like about the control voltage is the negative part.  It will complicate ADC conversion for the read, and the DAC for the write.
...

The control and sense voltages are all positive. Might be hard to read on the image, but it says ~0.97V/A, not -0.97V/A. Wasn't able to nail down a more precise constant, possibly because there's some non-linearity involved (due to the shunt temperature perhaps?).


Wow, so much have been done in the little time I have been busy-up finishing another project.  This is good stuff!

Glad to someone read this right:  ~0.97 and not -0.97.  I need to upgrade my glasses.

The shunt temperature makes it very difficult.  When I tested its reaction to heat, even with a PC-case fan (2.5") blowing (at approx 68-70F, the cold (first power on) is still measurably different from fan-cooled reading.  Fan-cool do keep it at more-or-less constant, just at a higher number than cool.  Regardless, I decided to wait on slope/intercept constant until I get my 75ppm shunt replacement.  I will report back on how that works out hopefully fairly soon.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf