Re: Project: Teacup Firmware October 07, 2012 06:25AM |
Registered: 13 years ago Posts: 7,616 |
Quote
I do not see where heater_pwm is set to 30
Quote
Maybe one could disable the PWM output by clearing the heater_pwm pointer to zero somehow.
/***************************************************************************\ ... * Set "strategy" to ... * * - BANG_BANG to disable PWM and use bang bang instead * * - 76Hz to use low frequency PWM (requires a PWM-able pin) * * - 78kHz to use high frequency PWM (requires a PWM-able pin) * * * \***************************************************************************/ // name port strategy DEFINE_HEATER(extruder, PB3, 76Hz) DEFINE_HEATER(bed, PB4, BANG_BANG) DEFINE_HEATER(fan, PB5, 78kHz)be too complex for newbies? Ideally, making different strategies for different heaters possible.
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 07, 2012 06:36PM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 08, 2012 02:10AM |
Registered: 12 years ago Posts: 258 |
Re: Project: Teacup Firmware October 08, 2012 08:15AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 11, 2012 08:56PM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 11, 2012 09:00PM |
Registered: 13 years ago Posts: 155 |
Re: Project: Teacup Firmware October 12, 2012 07:38AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 14, 2012 11:14AM |
Registered: 12 years ago Posts: 258 |
v21837:Teacup_Firmware drf$ git diff upstream Gen7 temp.c diff --git a/temp.c b/temp.c index 7f348d7..653b1ba 100644 --- a/temp.c +++ b/temp.c @@ -297,9 +297,9 @@ void temp_sensor_tick() { #endif #define EWMA_SCALE 1024L #define EWMA_ALPHA ((long) (TEMP_EWMA * EWMA_SCALE)) - temp_sensors_runtime.last_read_temp = (EWMA_ALPHA * temp + + temp_sensors_runtime.last_read_temp = (uint16_t) ((EWMA_ALPHA * temp + (EWMA_SCALE-EWMA_ALPHA) * temp_sensors_runtime.last_read_temp - ) / EWMA_SCALE; + ) / EWMA_SCALE); } if (labs((int16_t)(temp_sensors_runtime.last_read_temp - temp_sensors_runtime.target_temp) if (temp_sensors_runtime.temp_residency < (TEMP_RESIDENCY_TIME*120))
Re: Project: Teacup Firmware October 14, 2012 06:42PM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 15, 2012 12:08AM |
Registered: 12 years ago Posts: 258 |
Re: Project: Teacup Firmware October 17, 2012 07:36AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 17, 2012 11:15AM |
Registered: 12 years ago Posts: 258 |
#### pronterface log of several M105 commands: >>>m105 SENDING:M105 ok T:18.50 B:61.50 >>>m105 SENDING:M105 ? >>>m105 SENDING:M105 ? >>>m105 SENDING:M105 ? >>>m105 SENDING:M105 ? >>>m105 SENDING:M105 ? ? >>>m105 SENDING:M105 ok T:18.50 B:61.50 ? ? >>>m114 SENDING:M114 ok X:8.000,Y:-9.000,Z:2.000,E:0.000,F:7800 >>>m114 SENDING:M114 ? >>>m114 SENDING:M114 ? >>>m105 SENDING:M105 ?
>>>m114 SENDING:M114 ok X:0.000,Y:0.000,Z:0.000,E:0.000,F:0 >>>m114 SENDING:M114 ok X:0.000,Y:0.000,Z:0.000,E:0.000,F:0 >>>m114 SENDING:M114 ok X:0.000,Y:0.000,Z:0.000,E:0.000,F:0 >>>m114 SENDING:M114 ok X:0.000,Y:0.000,Z:0.000,E:0.000,F:0 >>>m114 SENDING:M114 ok X:0.000,Y:0.000,Z:0.000,E:0.000,F:0
Re: Project: Teacup Firmware November 09, 2012 06:51AM |
Registered: 12 years ago Posts: 258 |
// Thermistor lookup table for RepRap Temperature Sensor Boards (http://reprap.org/wiki/Temperature_Sensor_2_0) // Made with createTemperatureLookup.py (https://github.com/triffid/Teacup_Firmware/blob/master/createTemperatureLookup.py) // (patched per [github.com]) // default thermistor lookup table // You may be able to improve the accuracy of this table in various ways. // 1. Measure the actual resistance of the resistor. It's "nominally" 4.7K, but that's ± 5%. // 2. Measure the actual beta of your thermistor:[reprap.org] // 3. Generate more table entries than you need, then trim down the ones in uninteresting ranges. // In either case you'll have to regenerate this table, which requires python, which is difficult to install on windows. // Since you'll have to do some testing to determine the correct temperature for your application anyway, you // may decide that the effort isn't worth it. Who cares if it's reporting the "right" temperature as long as it's // keeping the temperature steady enough to print, right? // Temp*4 table from [github.com] // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=2700 --beta=4092 --max-adc=1023 --min_adc=20 --multiplier=4 --vadc=5.0 // r0: 100000 // t0: 25 // r1: 0 (parallel with rTherm) // r2: 2700 (series with rTherm) // beta: 4092 // min adc: 20 at 0.09765625 V // max adc: 1023 at 4.9951171875 V // ADC counts from 20 to 1023 by 52 #define NUMTEMPS 21 // {ADC, temp*4 }, // temp Rtherm Vtherm resolution power uint16_t temptable[NUMTEMPS][2] PROGMEM = { { 20, 1548}, // 387.20 C, 54 Ohm, 0.098 V, 5.62 C/count, 0.18mW { 72, 1080}, // 270.22 C, 204 Ohm, 0.352 V, 1.09 C/count, 0.61mW { 124, 920}, // 230.13 C, 372 Ohm, 0.605 V, 0.57 C/count, 0.99mW { 176, 823}, // 205.99 C, 560 Ohm, 0.859 V, 0.39 C/count, 1.32mW { 228, 754}, // 188.57 C, 773 Ohm, 1.113 V, 0.29 C/count, 1.60mW { 280, 699}, // 174.77 C, 1016 Ohm, 1.367 V, 0.24 C/count, 1.84mW { 332, 652}, // 163.18 C, 1295 Ohm, 1.621 V, 0.21 C/count, 2.03mW { 384, 612}, // 153.02 C, 1620 Ohm, 1.875 V, 0.19 C/count, 2.17mW { 436, 575}, // 143.82 C, 2002 Ohm, 2.129 V, 0.17 C/count, 2.26mW { 488, 541}, // 135.28 C, 2458 Ohm, 2.383 V, 0.16 C/count, 2.31mW { 540, 508}, // 127.16 C, 3012 Ohm, 2.637 V, 0.15 C/count, 2.31mW { 592, 477}, // 119.26 C, 3700 Ohm, 2.891 V, 0.15 C/count, 2.26mW { 644, 445}, // 111.43 C, 4576 Ohm, 3.145 V, 0.15 C/count, 2.16mW { 696, 413}, // 103.47 C, 5729 Ohm, 3.398 V, 0.16 C/count, 2.02mW { 748, 380}, // 95.18 C, 7317 Ohm, 3.652 V, 0.16 C/count, 1.82mW { 800, 344}, // 86.25 C, 9643 Ohm, 3.906 V, 0.18 C/count, 1.58mW { 852, 304}, // 76.21 C, 13374 Ohm, 4.160 V, 0.21 C/count, 1.29mW { 904, 256}, // 64.14 C, 20340 Ohm, 4.414 V, 0.26 C/count, 0.96mW { 956, 190}, // 47.64 C, 37959 Ohm, 4.668 V, 0.39 C/count, 0.57mW {1008, 55}, // 13.89 C, 170100 Ohm, 4.922 V, 1.25 C/count, 0.14mW {1016, 1} // 0.44 C, 342900 Ohm, 4.961 V, 2.19 C/count, 0.07mW };
Re: Project: Teacup Firmware November 09, 2012 01:37PM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware November 10, 2012 05:51PM |
Registered: 12 years ago Posts: 258 |
v21837:Teacup_Firmware drf$ git diff heater.c diff --git a/heater.c b/heater.c index 51ed374..62998e0 100644 --- a/heater.c +++ b/heater.c @@ -132,7 +132,10 @@ void heater_init() { TCCR4A = MASK(PWM4A) | MASK(PWM4 ; // enable A and B TCCR4C = MASK(PWM4D); // and D TCCR4D = MASK(WGM40); // Phase correct - TCCR4B = MASK(CS40); // no prescaler + TCCR4B = MASK(CS40); // no prescaler 16MhZ + #ifndef FAST_PWM + TCCR4B = MASK(CS40) | MASK(CS42) | MASK(CS43); // 16mhz / 4096 /256 + #endif TC4H = 0; // clear high bits OCR4C = 0xff; // 8 bit max count at top before reset #else @@ -425,7 +428,7 @@ void heater_set(heater_t index, uint8_t value) { *(heaters[index].heater_pwm) = value; #ifdef DEBUG if (DEBUG_PID && (debug_flags & DEBUG_PID)) - sersendf_P(PSTR("PWM{%u = %u}\n"), index, OCR0A); + sersendf_P(PSTR("PWM{%u = %u}\n"), index, *heaters[index].heater_pwm); #endif } else {
Re: Project: Teacup Firmware November 11, 2012 08:27AM |
Registered: 13 years ago Posts: 7,616 |
Re: Project: Teacup Firmware November 14, 2012 11:53AM |
Registered: 12 years ago Posts: 258 |
$ git diff -w upstream Gen7 heater.c diff --git a/heater.c b/heater.c index df03488..7c5b162 100644 --- a/heater.c +++ b/heater.c @@ -138,9 +138,9 @@ void heater_init() { TCCR4A = MASK(PWM4A) | MASK(PWM4 ; // enable A and B TCCR4C = MASK(PWM4D); // and D TCCR4D = MASK(WGM40); // Phase correct - TCCR4B = MASK(CS40); // no prescaler + TCCR4B = MASK(CS40); // no prescaler 16MHz/256 #ifndef FAST_PWM - TCCR4B = MASK(CS40) | MASK(CS42) | MASK(CS43); // 16mhz / 4096 /256 + TCCR4B = MASK(CS40) | MASK(CS41) | MASK(CS43); // 16MHz / 1024 /256 #endif TC4H = 0; // clear high bits OCR4C = 0xff; // 8 bit max count at top before reset
$ git diff -w upstream Gen7 createTemperatureLookup.py diff --git a/createTemperatureLookup.py b/createTemperatureLookup.py index e0b9f27..c9906a5 100755 --- a/createTemperatureLookup.py +++ b/createTemperatureLookup.py @@ -32,6 +32,7 @@ Options: --min-adc=... the minimum ADC reading to use. --vadc=... ADC reference voltage (high leg of R2) same as Vcc --vcc=... Voltage divider supply (high leg of R2) Unused + --table Format data as one of an array of tables It is suggested to generate more values than you need, and delete some of the ones in the ranges that aren't interesting. This will improve accuracy in the temperature ranges that are important to you. @@ -91,9 +92,11 @@ def main(argv): vadc=5.0 vcc=5.0 mult=4 + table=False try: - opts, args = getopt.getopt(argv, "h", ["help", "r0=", "t0=", "beta=", "r1=", "r2=", "max-adc=", "min-adc=", "num-temps=", "vcc=","vadc=","mult + opts, args = getopt.getopt(argv, "h", ["help", "r0=", "t0=", "beta=", "r1=", "r2=", "max-adc=", "min-adc=", + "num-temps=", "vcc=","vadc=","multiplier=","table"]) except getopt.GetoptError: usage() sys.exit(2) @@ -124,6 +127,8 @@ def main(argv): vcc = float(arg) elif opt == "--multiplier": mult = float(arg) + elif opt == "--table": + table = True if r1: max_adc = int(1023. * r1 / (r1 + r2)) else: @@ -158,8 +163,8 @@ def main(argv): print "// Since you'll have to do some testing to determine the correct temperature for your application anyway, you" print "// may decide that the effort isn't worth it. Who cares if it's reporting the \"right\" temperature as long as it's" print "// keeping the temperature steady enough to print, right?" - print "// Temp*%s table from [github.com]" %mult - print "// ./createTemperatureLookup.py --r0=%s --t0=%s --r1=%s --r2=%s --beta=%s --max-adc=%s --min_adc=%s --multiplier=%s --vadc=%s" % ( + print "// Temp*%s table from [github.com]" %mult + print "// ./createTemperatureLookup.py --r0=%s --t0=%s --r1=%s --r2=%s --beta=%s --max-adc=%s --min-adc=%s --multiplier=%s --vadc=%s" % ( r0, t0, r1, r2, beta, max_adc, min_adc, mult, vadc) print "// r0: %s" % (r0) print "// t0: %s" % (t0) @@ -169,10 +174,15 @@ def main(argv): print "// min adc: %s at %s V" % (min_adc, min_adc*t.vadc/1024) print "// max adc: %s at %s V" % (max_adc, max_adc*t.vadc/1024) print "// ADC counts from {min} to {max} by {x}".format(min=min_adc, max=max_adc, x=increment) + if table == True: + print "// #define NUMTABLES 1 // These three lines open the temptable[NUMTABLES]... array" + print "// #define NUMTEMPS %s // ... " % (len(adcs)) + print "// uint16_t temptable[NUMTABLES][NUMTEMPS][2] PROGMEM = { // ..." + print "{ //" + " Table 0 chunk for B={b}, R0={r0}, R1={r1}, R2={r2}, Vref={v}".format(par="{",b=beta,r0=r0,r1=r1,r2=r2,v=vadc) + else: print "#define NUMTEMPS %s" % (len(adcs)) - print "// {ADC, temp*%s }, // temp Rtherm Vtherm resolution power" % (mult) print "uint16_t temptable[NUMTEMPS][2] PROGMEM = {" - + print "// {ADC, temp*%s }, // temp Rtherm Vtherm resolution power" % (mult) counter = 0 for adc in adcs: counter = counter +1 @@ -183,7 +193,11 @@ def main(argv): resolution = ( t.temp(adc-1)-t.temp(adc) if adc>1 else t.temp(adc) -t.temp(adc+1)) sep = (',' if counter != len(adcs) else ' ') print " {%4s, %6s}%s // %7.2f C, %7.0f Ohm, %0.3f V, %0.2f C/count, %0.2fmW" % (adc, int(t.temp(adc)*mult), sep,degC, resistance,vTherm,res + if table == False: print "};" + else: + print '}, // remove comma for last table chunk' + print "// }; // Closure for the temptable[NUMTABLES] array" def usage(): print __doc__
$ git diff -w upstream/Gen7 Makefile diff --git a/Makefile b/Makefile index f797024..189c710 100644 --- a/Makefile +++ b/Makefile @@ -150,7 +151,7 @@ program: $(PROGRAM).hex config.h stty 115200 raw ignbrk -hup -echo ixoff < $(PROGPORT) clean: clean-subdirs - rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.al *.i *.s *~ + rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.al *.i *.s *~ .depend clean-subdirs: @for dir in $(SUBDIRS); do \ @@ -180,6 +181,16 @@ functionsbysize: $(OBJ) @echo " CC $@" @$(CC) -c $(CFLAGS) -Wa,-adhlns=$(<:.c=.al) -o $@ $(subst .o,.c,$@) + +depend: .depend + +.depend: $(SOURCES) + rm -f ./.depend + $(CC) $(CFLAGS) -MM $^ > ./.depend; + +# pull in dependency info for SOURCES files +-include .depend + %.elf: $(OBJ) @echo " LINK $@" @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
Re: Project: Teacup Firmware November 15, 2012 07:36AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware November 15, 2012 12:03PM |
Registered: 12 years ago Posts: 258 |
ThermistorTable.h: config.h ./createThermistorTable.h --num_temps=10 --BRR2=4092,100000,4700 --BRR2=4190,100000,10000 > $@
Re: Project: Teacup Firmware November 19, 2012 04:28PM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware November 27, 2012 09:58AM |
Registered: 12 years ago Posts: 258 |
Re: Project: Teacup Firmware January 03, 2013 09:46AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware January 26, 2013 10:47PM |
Registered: 13 years ago Posts: 632 |
Re: Project: Teacup Firmware January 27, 2013 05:37AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware January 27, 2013 11:14AM |
Registered: 13 years ago Posts: 632 |
Re: Project: Teacup Firmware February 04, 2013 03:43PM |
Registered: 12 years ago Posts: 258 |
$ make rm -f build/depend mkdir -p build avr-gcc -DF_CPU=16000000L -mmcu=at90usb1287 -g -Wall -Wstrict-prototypes -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Winline -fno-move-loop-invariants -fno-tree-scev-cprop -Os -ffunction-sections -finline-functions-called-once -mcall-prologues -save-temps=obj -MM analog.c clock.c copier.c crc.c dda.c dda_maths.c dda_queue.c debug.c delay.c gcode_parse.c gcode_process.c graycode.c heater.c home.c intercom.c mendel.c pinio.c sd.c serial.c sermsg.c sersendf.c temp.c timer.c usb_serial.c watchdog.c > build/depend avr-gcc: unrecognized option '-save-temps=obj' ...
v21837:TeacupTriffidGen7_20130204 drf$ make rm -f build/depend mkdir -p build avr-gcc -DF_CPU=16000000L -mmcu=at90usb1286 -g -Wall -Wstrict-prototypes -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Winline -fno-move-loop-invariants -fno-tree-scev-cprop -Os -ffunction-sections -finline-functions-called-once -mcall-prologues -save-temps=obj -MM analog.c clock.c copier.c crc.c dda.c dda_maths.c dda_queue.c debug.c delay.c gcode_parse.c gcode_process.c graycode.c heater.c home.c intercom.c mendel.c pinio.c sd.c serial.c sermsg.c sersendf.c temp.c timer.c usb_serial.c watchdog.c > build/depend CC build/analog.o In file included from temp.h:4:0, from analog.c:7: config.h:46:0: warning: "HOST" redefined [enabled by default] /usr/local/CrossPack-AVR-20121207/lib/gcc/avr/4.6.2/../../../../avr/include/avr/iousbxx6_7.h:951:0: note: this is the location of the previous definition CC build/clock.o ....
... CC build/usb_serial.o usb_serial.c:155:8: warning: type defaults to 'int' in declaration of 'prog_uint8_t' [enabled by default] usb_serial.c:155:8: error: variable 'prog_uint8_t' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:155:50: error: expected ',' or ';' before 'device_descriptor' usb_serial.c:173:45: error: variable 'config1_descriptor' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:257:73: error: variable 'string0' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:262:73: error: variable 'string1' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:267:73: error: variable 'string2' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:272:73: error: variable 'string3' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:285:32: error: variable 'descriptor_list' must be const in order to be put into read-only section by means of '__attribute__((progmem))' usb_serial.c:286:19: error: 'device_descriptor' undeclared here (not in a function) ...
Re: Project: Teacup Firmware February 05, 2013 08:20AM |
Registered: 13 years ago Posts: 7,616 |
Quote
What hardware are folks using with the arduino_usb1287.h / MCU_TARGET = at90usb1287 configuration of Teacup?
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware February 05, 2013 11:09AM |
Registered: 12 years ago Posts: 258 |
Re: Project: Teacup Firmware February 10, 2013 07:30AM |
Registered: 13 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware February 18, 2013 12:32PM |
Registered: 12 years ago Posts: 258 |