Skip to content

Commit

Permalink
Merge pull request #29 from UnifiedEngineering/master
Browse files Browse the repository at this point in the history
Refresh the max31855 branch
  • Loading branch information
xnk committed Dec 21, 2014
2 parents 36d21ed + 9f20364 commit c5da481
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
T-962 reflow oven improvements
==============================

Please see the <a href="https://github.com/UnifiedEngineering/T-962-improvements/wiki">Wiki</a> for more info.
Please see the <a href="https://github.com/UnifiedEngineering/T-962-improvements/wiki">Wiki</a> for more info. Also, Travis-CI can be found <a href="https://travis-ci.org/UnifiedEngineering/T-962-improvements">here</a>.

As we had use for a small reflow oven for a small prototype run we settled for the T-962 even after having seen the negative reviews of it as there were plenty of suggestions all across the Internet on how it could be improved including replacing the existing controller and display(!). After having had a closer look at the hardware (replacing the masking tape inside with Kapton tape first) it was obvious that there was a simple way to improve the software disaster that is the T-962.

Expand Down
36 changes: 31 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ __attribute__((weak)) const char* Version_GetGitVersion(void) {
// Support for boot ROM functions (get part number etc)
typedef void (*IAP)(unsigned int [],unsigned int[]);
IAP iap_entry = (void*)0x7ffffff1;
#define IAP_READ_PART (54)
#define IAP_READ_PART (54)
#define IAP_REINVOKE_ISP (57)
#define PART_REV_ADDR (0x0007D070)
typedef struct {
const char* name;
Expand Down Expand Up @@ -101,6 +102,27 @@ int main(void) {
char buf[22];
int len;

/* Hold F1-Key at boot to force ISP mode */
if ((IOPIN0 & (1<<23)) == 0) {
//NB: If you want to call this later need to set a bunch of registers back
// to reset state. Haven't fully figured this out yet, might want to
// progmatically call bootloader, not sure. If calling later be sure
// to crank up watchdog time-out, as it's impossible to disable
//
// Bootloader must use legacy mode IO if you call this later too, so do:
// SCS = 0;

//Turn off FAN & Heater using legacy registers so they stay off during bootloader
//Fan = PIN0.8
//Heater = PIN0.9
IODIR0 = (1<<8) | (1<<9);
IOSET0 = (1<<8) | (1<<9);

//Re-enter ISP Mode, this function will never return
command[0] = IAP_REINVOKE_ISP;
iap_entry((void *)command, (void *)result);
}

PLLCFG = (1<<5) | (4<<0); //PLL MSEL=0x4 (+1), PSEL=0x1 (/2) so 11.0592*5 = 55.296MHz, Fcco = (2x55.296)*2 = 221MHz which is within 156 to 320MHz
PLLCON = 0x01;
PLLFEED = 0xaa;
Expand Down Expand Up @@ -143,7 +165,7 @@ int main(void) {

// Request part number
command[0] = IAP_READ_PART;
iap_entry(command, result);
iap_entry((void *)command, (void *)result);
const char* partstrptr = NULL;
for(int i=0; i<NUM_PARTS; i++) {
if(result[1] == partmap[i].id) {
Expand All @@ -158,7 +180,7 @@ int main(void) {
} else {
partrev += 'A' - 1;
}
len = snprintf(buf,sizeof(buf),"%s rev %c",partstrptr,partrev);
len = snprintf(buf,sizeof(buf),"%s rev %c",partstrptr,(int)partrev);
LCD_disp_str((uint8_t*)buf, len, 0, 64-6, FONT6X6);
printf("\nRunning on an %s", buf);

Expand All @@ -180,9 +202,13 @@ int main(void) {
Buzzer_Beep( BUZZ_1KHZ, 255, TICKS_MS(100) );

while(1) {
#ifdef ENABLE_SLEEP
int32_t sleeptime;
sleeptime=Sched_Do( 0 ); // No fast-forward support
//printf("\n%d ticks 'til next activity"),sleeptime);
#else
Sched_Do( 0 ); // No fast-forward support
#endif
}
return 0;
}
Expand Down Expand Up @@ -283,7 +309,7 @@ static int32_t Main_Work( void ) {
len = snprintf(buf,sizeof(buf),"%03u",Reflow_GetActualTemp());
LCD_disp_str((uint8_t*)"ACT", 3, 110, 20, FONT6X6);
LCD_disp_str((uint8_t*)buf, len, 110, 26, FONT6X6);
len = snprintf(buf,sizeof(buf),"%03u",ticks);
len = snprintf(buf,sizeof(buf),"%03u",(unsigned int)ticks);
LCD_disp_str((uint8_t*)"RUN", 3, 110, 33, FONT6X6);
LCD_disp_str((uint8_t*)buf, len, 110, 39, FONT6X6);
if(Reflow_IsDone() || keyspressed & KEY_S) { // Abort reflow
Expand Down Expand Up @@ -337,7 +363,7 @@ static int32_t Main_Work( void ) {
if(setpoint>300) setpoint = 300;
}

len = snprintf(buf,sizeof(buf),"- SETPOINT %uC +",setpoint);
len = snprintf(buf,sizeof(buf),"- SETPOINT %uC +",(unsigned int)setpoint);
LCD_disp_str((uint8_t*)buf, len, 64-(len*3), 10, FONT6X6);

LCD_disp_str((uint8_t*)"F1", 2, 0, 10, FONT6X6 | INVERT);
Expand Down

0 comments on commit c5da481

Please sign in to comment.