HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron driver

A place to document your own projects.

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Tue May 15, 2012 6:48 pm

The serial data is
Seconds since start, target temperature, measured temperature, NTC temperature, Pk, Ik, Dl, PTerm, ITerm, DTerm, PWM

The output you sent look messed up :(

I will check the source in the morning and upload the latest hex with defaults set for for hakko handle.

Question - can you enter the menu? Try to enter calibration menu and select RTD HAKKO. APPLY and SAVE changes and reboot the iron after that.
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby pjkim » Wed May 16, 2012 1:58 am

Thank you for taking the time to help me troubleshoot this. The debug test was garbled in the forum reply. Here it is again:

Code: Select all
127.2580,-29952.0000,2147483647.-2147473649,37.7419,-2147483648.-2147483648,0.0000,2.0030,2147483647.-2147473649,2147483647.-2147473649,2147483647.-2147473649,100
127.5280,-29952.0000,2147483647.-2147473649,38.0645,-2147483648.-2147483648,0.0000,2.0030,2147483647.-2147473649,2147483647.-2147473649,2147483647.-2147473649,100


It should display properly now but as you can see, several of the numbers don't print properly. I think because they don't represent proper floating point numbers. So columns 3, 5, 8, 9, and 10 (measuredTemp, Pk, PTerm,ITerm,DTerm) are messed up, i.e. the third column value is 2147483647.-2147473649 and there are a correct number of comma delimited items.

I initially had a quadrature encoder hooked up and the encoder firmware loaded and could not enter the menu. I loaded the button firmware and could sort of enter the menu. I say sort of because I used a wire to pull down the appropriate pins to ground using a wire. I could sometimes enter the menu by grounding the button pin and increase/decrease the values for menu item 4 (init temp). It was a large negative value around -3000. I increased it to about -2000 when it went back to around -3000. I could not reliably step through the menu commands to select calibration. There appeared to be a lot of noise on the pins even though they were pulled up with 10K resistors. For example, when I tried to confirm that the pins were pulled up to 5V using a high impedance voltmeter, the 18f2550 registered a button press and entered the menu function. This didn't happen every time but every couple of tries it would work. I will try again with better/real switches but I think that the pins might not be behaving correctly.

Once again, thanks for your help.
pjkim
Newbie
Newbie
 
Posts: 46
Joined: Mon Apr 09, 2012 1:18 pm

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Wed May 16, 2012 2:27 am

The problem with floats not being shown correctly is function that prints them ain't perfect.

Code: Select all
void sendFloat(float x){
  long int lPart;
  long int rPart;
  lPart = (long int) x;
  rPart = (long int)( x * 10000.0)-lPart*10000;
  fprintf(_H_USART,  (const far rom char*)"%li.%04li,", lPart,rPart);
}


For it to display 2147483647.-2147473649, lpart is 2147483647 so when you *10000 it goes out of 32bit size, now how the hell it calculated 2147483647 in the first place for measured temp beats me :D

I see you have 39C for the NTC temp. Does this mean that you attached some NTC to the NTC connector?

Now, all you need to do is enter menu and select HAKKO RTD in calibration. What PCB are you using? The fully trough hole one DP designed or half smd one I made? If you are using mine, remove C1-C5 (just don't populate them) and replace R6-R10 with shorts. I replaced my original design with 7414 to copy this one from DP as it was supposed to be cheaper, but it ended up not working.

If you are using DP's version (100% trough hole) I think Filip already fixed the problem and removed capacitors and resistors but I'm not 100% sure.
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby pjkim » Wed May 16, 2012 3:09 am

I built the through-hole DP version 1.5. No capacitors or series resistors, only the 10K pullups on the button/encoder inputs. As for the NTC, it is not populated. The value is probably due a floating input at the op-amp for the NTC amplifier-- I did not include the pull-up resistor at the non-inverting input and it is already in a unity gain follower configuration on the PCB, ie output tied to inverting input.

Will try troubleshooting the button issue. I didn't understand the 7414 part-- did you put a Schmitt trigger between the buttons and the PIC inputs to cut down on noise? That didn't work? I take it the inputs are not debounced in software.
pjkim
Newbie
Newbie
 
Posts: 46
Joined: Mon Apr 09, 2012 1:18 pm

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Wed May 16, 2012 4:17 am

I was using schmitt yes, that's why there's no software debouncing in the firmware. That worked but DP suggested the solution with resistors and capacitors so I replaced the 74hc14 with those and it didn't work :( ... I myself use a small panel board with buttons and encoder that has 74hc14 on it so I do not have the problem but I should add debouncing in firmware too, it's just that I don't have time to deal with it now .. if you have 74xx14 you can use it to debounce the input and solve the prob in hw
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Sat May 19, 2012 9:24 pm

I caught few minutes so here's the updated HEX (for using buttons, not encoder) with software debouncing.

the only change in source is in the 2 isr functions in main.c and it's very simple, any interrupts that come faster then 250ms are ignored :D so plenty of time for debouncing. I prefer 100ms to 250ms but I put 250ms as it will work with bad switches too :)

FIXED CODE:

hardware.h
Code: Select all
#define DEBOUNCE_TIME 200


and main.c
Code: Select all
#pragma code
#pragma interruptlow low_isr

void low_isr(void) {
    static unsigned long int debounce = 0;
    unsigned long int isr_started = millis;


    if (INTCON3bits.INT1IF) { //ENC1 rising edge
        if (isr_started - debounce > DEBOUNCE_TIME) {

#ifdef USE_ENCODER
            if (PIN_E2) {
                if (encoder > encoderMIN) encoder--;
            } else {
                if (encoder < encoderMAX) encoder++;
            }
#else
            if (encoder > encoderMIN) encoder--;
#endif
            changed = 1;
        }
        INTCON3bits.INT1IF = 0;
    } else if (INTCON3bits.INT2IF) { //ENC2 rising edge
        if (isr_started - debounce > DEBOUNCE_TIME) {

#ifdef USE_ENCODER
#ifndef DETENT_DOUBLE
            if (PIN_E1) {
                if (encoder < encoderMAX) encoder++;
            } else {
                if (encoder > encoderMIN) encoder--;
            }
            changed = 1;
#endif
#else
            if (encoder < encoderMAX) encoder++;
            changed = 1;
#endif
        }
        INTCON3bits.INT2IF = 0;
    } else if (PIR1bits.TMR2IF) {
            millis += 2;
            if (((menu < 10) || (menu > 12)) && (starting != 1) && (measuredTemperature > TOOHOT)) while (1) heaterOFF();
            if (++heaterPos > maxHeaterPos) heaterPos = 0;
            if (heaterPos >= pwmValue) {
                heaterOFF();
            } else {
                heaterON();
            }
        PIR1bits.TMR2IF = 0;
    }

    debounce = isr_started;
}

#pragma code
#pragma interrupt high_isr

void high_isr(void) {
    static unsigned long int debounce = 0;
    unsigned long int isr_started = millis;

    if (INTCONbits.INT0IF) {
        if (isr_started - debounce > DEBOUNCE_TIME) menu++;
        INTCONbits.INT0IF = 0;
    }
    debounce = isr_started;
}

Last edited by arhi on Tue May 22, 2012 6:17 am, edited 1 time in total.
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby pjkim » Mon May 21, 2012 11:06 pm

Ahri,
I tried the hex file you sent-- it gives a "ERROR: WD0001" I tried changing the WD timer prescaler to 1:8192 but still gives the same error-- after a longer time of course.

I tried copying/pasting your changes (fix 8-?) to the source code and same problem-- ERROR: WD0001.

I will actually try reading the changes and see if I can find out what is going on.

Peter
pjkim
Newbie
Newbie
 
Posts: 46
Joined: Mon Apr 09, 2012 1:18 pm

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Tue May 22, 2012 6:15 am

here's fixed version, this one should work

problem was that I encompassed too much of the isr routine with debouncing if() :D
Attachments
sid.zip
(63.62 KiB) Downloaded 458 times
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Tue May 22, 2012 3:48 pm

I moved SVN to SourceForge

To get source (mplabx project):
Code: Select all
svn co https://arhimed-sid.svn.sourceforge.net/svnroot/arhimed-sid arhimed-sid


To get latest "binaries" (pdf's for pcb, hex and cof for mcu): http://sourceforge.net/projects/arhimed-sid/files

Web page is super ugly, and is missing many informations ... if anyone wish to donate better web page - feel free :)

If you think I'm missing something on that page (link to some DP resource..) please send me pm with the info :)
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby pjkim » Tue May 22, 2012 11:45 pm

Ahri,
Tried the latest firmware you posted. The watchdog error is fixed. The debouncing for the button works but the up and down buttons don't work at all. I can now enter into the menu and step through the items (1 through 6) one at a time but can't change anything because the other buttons don't work.
Peter
pjkim
Newbie
Newbie
 
Posts: 46
Joined: Mon Apr 09, 2012 1:18 pm

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Wed May 23, 2012 5:31 am

there are only 3 buttons, menu, + and - (or menu, encoder1, encoder2). What "other buttons" ? when you enter the menu, you click on menu button to select option (I apologize for posting untested sw, all my sid boards are in the workshop and I'm at home these days)
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby pjkim » Wed May 23, 2012 6:54 am

Thanks Ahri,
I guess I was using the terminology from the DP V1.5 board where the menu, + and - buttons are labeled EB, E1, E2. The menu button works and is debounced. The + and - buttons do nothing. They would increase and decrease some values in the previous firmware. Another issue I have is that the initial values for the P, I, D, values are set wrong-- they are set to 0.000, 0,000, and 2.004. Looking at the EEPROM, only the first 10 bytes are non-FF: the P, I, and D and two more bytes. I am wondering if my PIC programmer (the program, not the hardware) is not reading the hex files correctly. It does program the EEPROM correctly because if I copy the 3rd float into the first and second, the initial PID values all become 2.004.

This means that one of my problems is that the EEPROM data is not correct-- leading to the crazy debug data I posted earlier. I will try changing the EEPROM data by hand to see if that fixes the problem.
Peter
pjkim
Newbie
Newbie
 
Posts: 46
Joined: Mon Apr 09, 2012 1:18 pm

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Wed May 23, 2012 7:01 am

weird ... I'll try to check the firmware locally on some board, I left all my boards in workshop...

as for eeprom, it should work ok, but if it doesn't, you should be able to set and store those values easily when you get your buttons working :)

btw, have you tried pressing the +/- buttons "longer" ?
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby pjkim » Wed May 23, 2012 7:26 am

One thought is that perhaps the hex file is for an encoder input rather than for buttons? Is this selected by #defining USE_ENCODER (or not) in the main.c file? Do you expect the debounce code will work with an encoder?
pjkim
Newbie
Newbie
 
Posts: 46
Joined: Mon Apr 09, 2012 1:18 pm

Re: HAKKO (907ESD) and SOLOMON (SL-10/30) soldering iron dri

Postby arhi » Wed May 23, 2012 8:39 am

wrt eeprom values, the source has:

Code: Select all

#pragma romdata pid_values=0xf00000
rom float pid_values[] = {
  3.500,                                 //Initial P value
  1.875,                                 //Initial I value
  3.250                                  //Initial D value
};

#pragma romdata startup_temp=0xf0000C
rom signed int startup_temp[] = { 20 };       // Initial start temp value (/5)

#pragma romdata sleep_temp=0xf0000E
rom signed int sleep_temp[] = { 300 };        // Sleep temp value (times 2)

#pragma romdata boost_temp=0xf00010
rom signed int boost_temp[] = { 800 };        // Boost temp value (times 2)

#pragma romdata backglight_value=0xf00012
rom signed int backglight_value[] = { 50 };   // backglight value 0-100

#pragma romdata calibration_data=0xf00014
rom float calibration_data[] = {
       0.75,                                  // SLOPE  (HAKKO ORIGINAL)
    -207.00                                   // OFFSET (HAKKO ORIGINAL)
};


when you load hex it should show proper values. Float is 32bits in C18, so P=3.50 should be first 4 bytes.
0x00 0x00 0x60 0x40 = 0b00000000 00000000 01100000 01000000
so:
EXP = 01000000
byte0 = 01100000
byte1 = 00000000
byte2 = 00000000

Sign is 0
Exponent is 1
Mantissa is 1.11 (1+2^-1+2^-2 = 1.75)

2^1 * 1.75 = 3.5

so I'd say eeprom has proper values ... (as expected as it's put there directly by c18)

Now, it is possible that there's actually a bug in C18 here as I read in C18 lib that C18 stores floats different from IEE754 so it's not that exponent byte holds the sign and byte0 holds the 8th bit of the exponent (as we properly see here in the eeprom) but byte0 holds the sign while exp is a 8bit value of exponent. If this is true then C18 has a serious bug ..

What's worse, DS51297F-page 158 show that float is stored:
± e7 e6 e5 e4 e3 e2 e1 e0 d0 d1 d2 d3 · · · d23
and this coincides with what we see in eeprom

but, DS51288A-page 10 show that differently from normal IEE754 C18 stores floats as:
e0 e1 e2 e3 e4 e5 e6 e7 ± d0 d1 d2 d3 · · · d23

Now if this is true then we have a case where C18 stored one format in eeprom and is reading another format .. that does not make sense to me but since I can't test it attm ..

What do you read from hex? Are you sure you enabled your programmer to write to eeprom (by default that might be off)?
Attachments
sid eeprom.png
sid eeprom.png (2.52 KiB) Viewed 9267 times
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2160
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

PreviousNext

Return to Project logs