Author Topic: CFW for KSGER/Quicko STM32 Soldering Stations  (Read 675023 times)

0 Members and 5 Guests are viewing this topic.

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1225 on: July 01, 2021, 11:08:16 pm »
Ok, it looked like something else connected  :-DD.
I wonder if 48/64 pin devices, although GPIO compatible (Ex. PB8 is the same in both), are different at mapping the peripherals.
Edit: It works correctly
I'm checking it.
« Last Edit: July 01, 2021, 11:15:17 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline wickated

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: ru
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1226 on: July 01, 2021, 11:13:14 pm »
dont worry if it wont work. even if im jealous u have rtx3090 fps in your solder station  :-DD :-DD
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1227 on: July 02, 2021, 12:16:30 am »
I don't know why it doesn't work for you... Here its doing perfect.
Check my Ksger v2.1... :popcorn:
The left pins are are sw i2c, wired to the hw pins.
The detection works perfectly. Setting the hw i2c too fast will also fail and set sw mode.





The stock 10K resistors make an RC filter and limit a lot the i2c frequency. They're meant for the standard 400KHz, and it works perfecty in that conditions.
Stretching the timing to the limits, it could handle 900KHz in hw mode.
Curiously, that's a litle less that what I do in sw mode, because I don't care about the acks/nacks, I just send the data hoping it reaches its destination.
Since there haven't been any issues with sw i2c, why add more complexity?

« Last Edit: July 02, 2021, 12:48:53 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline StephenR0

  • Regular Contributor
  • *
  • Posts: 52
  • Country: us
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1228 on: July 02, 2021, 02:14:49 am »
You're having so much fun.  I'm jealous.  :)
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1229 on: July 02, 2021, 04:48:10 am »
Well, I ditched the i2c hw. In this case, it's worse because you are tied to the hw timing you can't tweak anything else than purely clock speed.

In fact, I was able to vastly improve the algorithm by optimizing the code and squeezing the clock.
The clock period is the important thing here. You can't make a too short pulse or the receiver won't notice it.
But between pulses, you have to process the data, determine if the next bit is 1 or 0 and toggle de data line.
There is were I made the black magic. The time between pulses have gone to minimum.
Sometimes only 100nS between clocks, using the (now it's an advantage) delay of the slow i2c slew rate, instead doing it on sw, giving a performance boost.
I'm afraid of being sued by Philips for giving absolutely zero *** at their specification. Even the scope is no longer able to decode anything :-DD.

But if the display does, who cares! The result is that it now achieves 90fps. At 36MHz, and not optimized for speed!
Test it and report.
Edit: Updated with O2 optimizations.

New build for Ksger 2.1 available on github
« Last Edit: July 02, 2021, 06:25:34 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline wickated

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: ru
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1230 on: July 02, 2021, 09:34:53 am »
90 fps too

I don't know why it doesn't work for you... Here its doing perfect.
Check my Ksger v2.1... :popcorn:
possibly its caused by other resisitor nominals on spi wired display module. mine has 5k pullup resistors.
« Last Edit: July 02, 2021, 09:39:18 am by wickated »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1231 on: July 02, 2021, 11:32:27 am »
Doesn't make a difference. I tried with 10K and 220R, and worked.
But by no way the hw i2c could reach that speed at 36MHz core. The best I got was 67fps.
The module itself crashes if you go too fast.
Setting the CPU core to 80MHz (little overclock)  I could set the i2c to 3MHz (Theorically,  real was about 2.7MHz). And about 400fps.
But 90 is a lot more than you need.  Will work perfectly.
This is still strange. What's there? That's what I asked yesterday.

« Last Edit: July 02, 2021, 11:37:56 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline wickated

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: ru
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1232 on: July 02, 2021, 12:18:47 pm »
This is still strange. What's there? That's what I asked yesterday.
display module wires. just a bit damaged cuz i used hot air instead of spare iron
 

Offline Tugo

  • Regular Contributor
  • *
  • Posts: 117
  • Country: si
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1233 on: July 02, 2021, 01:45:09 pm »
Hi guys!

I don't know if it will make any changes but I tested 3 versions: SW, Auto and the latest one.
In SW and Auto I got 58 FPS and in the latest I got 93 FPS.

I still study the whole SW but it is getting slow since this is the first time with STM uC and I have limited time.
David, I didn't find a lot but I believe I found a variable that will not change anything if removed (settings.c -> checkSettings -> variable checksumtime is there that doesn't do anything). David, am I wrong and I don't understand how things are done? I know I don't know A LOT!!! But I really hope I am not wrong at least here. As I stated already it shouldn't change anything. This is just to see if I at least understand some things or that I really am |O
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1234 on: July 02, 2021, 03:26:28 pm »
Must be a joke...  :palm:
It's not that you don't known how things are done.
Because I couldn't have explained it better 2 or 3 post above, where you downloaded the file.
You simply come and say whatever without reading anything.
About the code, must be another joke.
When you want to know what a variable does, use the search function and find it yourself.
Of course it does something!
« Last Edit: July 02, 2021, 03:33:48 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Tugo

  • Regular Contributor
  • *
  • Posts: 117
  • Country: si
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1235 on: July 02, 2021, 03:33:57 pm »
David, I did try to find it but my screen is so small I didn't notice it at the end of if sentence  :-DD |O |O |O
And I didn't do a search, you are correct!
I should get into shadow sun is making it even worst!  :-//
I am sorry, David. And thank you for clearing things out.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1236 on: July 02, 2021, 03:50:41 pm »
Ohhh I'm not angry, I just encourage you to use your eyes!
Because if you search that variable you'll find:

if (......) || (CurrentTime-checksumtime<999)
    return;

If you don't understand what that  code does, what you need is to learn C!

I noticed something: my project began as a fork, and github search doesn't index forks with less stars than the original project.
So my repo code search didn't work. I made a new repo importing the existing one, but completely dettached from the original.
So now code search works. Ex:

https://github.com/deividAlfa/stm32_soldering_iron_controller/search?q=checksumsettings

Now you don't have excuses!  :-+
« Last Edit: July 02, 2021, 04:55:46 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Tugo

Offline Tugo

  • Regular Contributor
  • *
  • Posts: 117
  • Country: si
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1237 on: July 02, 2021, 04:52:30 pm »
 :palm:
I told you I have a small screen and that I DIDN'T use search BEFORE. I did use it AFTER you told me to use it and I found the missing and used variable.
Also I told you I didn't find it at the end of the IF sentence so you should know C language is not something I saw here first. Even tho I used decades ago I didn't forget it completely. David, you should also start reading our comments before judging me or anybody else.
Everybody makes mistakes. Even you, my friend. Please just help us to understand things better not just judging us and see that we are not your enemies.
Even you wasn't born with all the knowladge.  :-+

If you want from us not to comment anything about your code just let us know that and me for one will be dead silent.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1238 on: July 02, 2021, 04:59:36 pm »
Oh and don't take it badly, I know I'm a bit rude sometimes, but there aren't bad intentions!
It bugs me a bit is when people enters the forum to ask something that has been said 3 posts earlier, so yeah, I say "Hell, use your eyes or the damn search button!!"
More or less like this :-DD



« Last Edit: July 02, 2021, 05:02:47 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Tugo

Offline Tugo

  • Regular Contributor
  • *
  • Posts: 117
  • Country: si
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1239 on: July 02, 2021, 05:14:11 pm »
 :-DD
David, my question wasn't like that but I will take your critic  :-+
Now that I understand you and that you know you are like that makes things a little bit (just a little bit  :box:) better to understand.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1240 on: July 02, 2021, 07:07:36 pm »
The Samuel L. Jackson face was for the question "I tested the files, first I got 58fps, then 90,  did you made something to the oled.
While 3 post  earlier, where you downloaded the file: "(Lots of detail) Hey guys I made a lot of optimizations to the i2c code, now the screen runs at 90fps!"


This firmware is pretty complex. Although I did my best by adding comments and keeping the code tidy, there's still a lot of code.
It took me weeks to fully understand the code. I had never programmed arm/stm32, neither used eclipse, and my C skills were more than rusted.
So it was a long way until  I got there. I had to figure all by myself!

I can make a quick summary, but I can't keep answering such simple and basic questions like "does checksumtime do anything?", when the answer is in a 3-second-away search.
What I said, either download CubeIde and properly review the code (You can search in all project files with control+H), or use github search.

Actually the code is huge, but the program workflow is pretty simple.

(main.c, Init)
After CubeMX setup, it initializes the rest of the system, like:
  -Loading the system settings.
  -Enabling the ADC.
  -Runing ironInit (This is the most important part).

(iron.c, ironInit)
- Sets up some variables.
- Runs initTimers.
  That's the most crucial part, everything works based on the timers.
  The system watchdog is not being refreshed, so if the timers don't run, the system will reset.
  Once the timers started, the interrupts will run the rest of the program, resfreshing the WD.

(main.c, main)
The main function only runs non critical stuff:
- oled_handle: reads the processed input, updates the widgets, draws them and updates the screen.
- checkSettings: Tracks changes in system options and updates the stored data.

(main.c, program_handler)
Called from SysTick_Handler at 1KHz rate.
- Reads the encoder pins.
- Reads the wake input.
- Handles buzzer state.

And here it comes the important part, the interrupts!

(main.c, HAL_TIM_PWM_PulseFinishedCallback)-
 - Called when the PWM wave goes  low.
 - Checks that the adc status is correct, and enables the delay timer.

(main.c, HAL_TIM_PeriodElapsedCallback)
 - Called when the delay timer expired. Now it's time to sample the adc!
 - Runs ADC_Start_DMA.

(adc_global.c, ADC_Start_DMA)
- Starts the ADC in DMA mode

(adc_global.c, HAL_ADC_ConvCpltCallback)
- Called when the ADC conversion is done (All data, not single conversion).
- Refreshes the watchdog timer.
- Runs handle_ADC_Data (Processes and filters the adquired data).
- Runs handleIron (Checks for error conditions, timeouts, pwm setting updates, runs calculatePID to get the new PWM value).
- Runs runAwayCheck (If pwm is active, checks that the temperature is not going out of control).

If something wrong happens with the timers, or the program stalls somewhere, the watchdog won't be resfreshed anymore, and 500mS later the system will be resetted.

And that's pretty much it. The timing is adjusted so the PWM never starts again before the HAL_ADC_ConvCpltCallback ends.
On next PWM cycle everything happens again.
The time between the ADC conversion start and HAL_ADC_ConvCpltCallback finish is around 300uS.
The code is ajusted for 350uS to have a safety gap. Actually this timing is for 36MHz devices (KSGER v2/v3), for Quicko F103 and others running at 64MHz it's ~200uS, but I use the same timing for all because it hardly makes a difference while adds complexity.

For the rest, you'll have to look at it and learn, don't ever expect to understand in 2 nights a firmware that wasn't made by you!
« Last Edit: July 03, 2021, 01:11:12 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Tugo

Offline StephenR0

  • Regular Contributor
  • *
  • Posts: 52
  • Country: us
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1241 on: July 02, 2021, 08:39:27 pm »
So you don't need calibration reports anymore?  I had noticed a certain similarity with mine.  Maybe you still need reports from different hardware versions?

Edit:  I see your request is back in your sig.  :)
« Last Edit: July 02, 2021, 08:57:00 pm by StephenR0 »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1242 on: July 02, 2021, 08:57:48 pm »
Oops! I deleted that accidentally when adding the github link!
Of course I need, the firmware won't get any better unless people really start reporting them.
What I really need is 20 reports for same model, but different stations, to ensure there's coherency between them.
« Last Edit: July 03, 2021, 01:21:28 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1243 on: July 02, 2021, 09:02:31 pm »
display module wires. just a bit damaged cuz i used hot air instead of spare iron

What controller is that? I wonder if these pins are actually connected to something, routed below the stm32, it could explain why it doesn't work.
Anyways, who cares, in this case SW mode is faster!
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Tugo

  • Regular Contributor
  • *
  • Posts: 117
  • Country: si
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1244 on: July 02, 2021, 09:39:02 pm »
First of all thank you for your quick explanation where things are.  :-+ :-+ :-+
I didn't use GitHub to understand/search things (I use CubeIDE and when I  learn your code and found something I wanted to test I change it, compiled it and saw if it works like I thought it would) and I study your code for quite some time now. I just didn't have a lot of time as I already explained. After this message I will get back to the message you explained things because I need to got through it very carefully to see what I managed to understand myself and what I didn't.

I cannot give you any good soldering tip results at the moment because a lot of tips simply just don't work with your FW (even in the newest) but I will need to get home and put everything on the oscilloscope to give you more infos why. All I have here with me is a K tip that works with Ksger (just so that you will know it is not defective) and I cannot get it to work even at 200ms (delay at 50ms) at 240-270 C. I believe it works at above 400 C (even at 0.1 ms delay if I remember it correctly) but not below. That is why I wanted to change your code a little to test one thing but I didn't find where/how to change it yet.

Thank you David!
 

Offline wickated

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: ru
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1245 on: July 02, 2021, 11:24:31 pm »
What controller is that? I wonder if these pins are actually connected to something, routed below the stm32, it could explain why it doesn't work.
Anyways, who cares, in this case SW mode is faster!
stock display, i just detached it and encoder too for some fancy look. only have some resistors and caps on module itself.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1246 on: July 03, 2021, 01:01:28 am »
I was playing with the chinese jbc tip that still lives. Yep, the power is so huge that the pid needs to be lowered a lot.
The software is doing everythign correctly, it's just the PID parameters.
This is where maybe some people don't the see difference between "custom firmware" and "Professional firmware that was lab tested with 100 tips in all conditions".

After 5 minutes playing with the PID I got this. not perfect but gives you a example:
Code: [Select]
Chinese JBC clone PID

Kp: 18.00
Ki: 5.00
Kd: 2.00
Imax: 0.10
Imin: 0.00

Debugging with SW: (CubeIDe SWO viewer sucks! It's buggy, slow and sometimes reads weird data!)



If that works, it will be the default JBC PID.
I also updated the runaway detection to detect these cases where the tip (wrong timing, bad PID, new tip, etc) causes hard PID oscillation, going on-off-on-off all the time.
That could bypass the runaway detection. Now it stores the last 4 power values and makes the average.
Seems stable, not causing issues when removing the tip or plugging it in. But I touch the adc pin on purpose to inject 50Hz ac mains noise, the pid freaks out and yes, the runaway stops it.
So great, it never hurts some extra safety :-+
« Last Edit: July 03, 2021, 01:24:02 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline wickated

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: ru
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1247 on: July 03, 2021, 01:21:27 am »
i approve. since i have
Code: [Select]
p40
i10
d2
im0,2
about runaway - since tip end is not true ground, if u touch tip to smth grounded or common neutral, TC readout also drops and tip start to glow. hope this tweak should help for this rare situations. original jbc stations have ground leak detection.
« Last Edit: July 03, 2021, 01:29:18 am by wickated »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5954
  • Country: es
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1248 on: July 03, 2021, 01:53:03 am »
T12 are connected to internal gnd throught a 100K resistor (At least in Quicko).
JBCs are directly connected to gnd.
Never seen that issue.

Kp40? Seems crazy.  Doesn't overshoot like crazy?
Also, why you first complain about JBC overshooting more than 100ÂșC, but then adjust the PID and say nothing?
These are the things that help.

Thanks everyone for the donations!
New tips coming! :-+

I'm testign again Phil's PID algortihm. Seems to work correctly now, so I enabled it.
« Last Edit: July 03, 2021, 03:22:18 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline mastershake

  • Frequent Contributor
  • **
  • Posts: 411
  • Country: us
Re: CFW for STM32 OLED Digital Soldering Station with T12 Handle
« Reply #1249 on: July 03, 2021, 03:28:29 am »
been away for a bit had another surgery. cant see to well out of the eye still sadly. its pretty bad unfortunately. tumor is def dead though.

i flashed the newest ksger 3.x build to a v3.0 oled board and i keep getting hard fault system halted press btn message and then if i do a full reset in the menu it gets stuck at the error 8d screen if no iron is plugged in. i have to power cycle to get back to the menu. any thoughts. tried 2 different ksger 3 board same result. i did try to fully erase the chip and reflash a few times.

hard fault happens every time after i pick the tip type (t12, c210 etc) after program or in the setup screen. and when trying to go to settings randomly. after changing settings it get stuck on the error 8d screen randomly edit: hard fault also happens randomly when changing the settings then selecting back.
« Last Edit: July 03, 2021, 03:43:52 am by mastershake »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf