Welcome! Log In Create A New Profile

Advanced

Have I got Teacup Firmware config.h wrong?

Posted by emt 
emt
Have I got Teacup Firmware config.h wrong?
January 21, 2011 09:50AM
Hi

I am having another attempt at using 5DA on a Mega 1280.

My heater is on mega pin digital 3.

I have therefore filled in the structure as follows

struct {
volatile uint8_t *heater_port;
uint8_t heater_pin;
volatile uint8_t *heater_pwm;
} heaters[NUM_HEATERS] =
{
// port pin pwm
{ &PORTE, PINE5, &OC3C },

};

make produces this error:-

In file included from heater.c:15:
config.h:300: error: ‘DIO3’ undeclared here (not in a function)

Have I put the incorrect data in the structure or is there a problem elsewhere?

[Edit: Changed name to "Teacup Firmware" for the purposes of not confusing folk, after irc discussion. --Sebastien]

Edited 3 time(s). Last edit at 02/22/2011 02:13AM by SebastienBailard.


Regards

Ian
Re: Have I got FiveD on Arduino config.h wrong?
January 22, 2011 03:22AM
Try OCR3C smiling smiley


-----------------------------------------------
Wooden Mendel
Teacup Firmware
emt
Re: Have I got FiveD on Arduino config.h wrong?
January 22, 2011 05:44AM
Many thanks.

I was blindly copying the remarks in config.h, new to C and Linux.

I now get a warning:-

In file included from heater.c:15:
config.h:300: warning: initialisation from incompatible pointer type

Should I worry about this?

I have attached modified appendix data for config.h.dist


Regards

Ian
Attachments:
open | download - AppendixA.txt (3.1 KB)
Re: Have I got FiveD on Arduino config.h wrong?
January 23, 2011 07:07PM
You still need the ampersand on both ports, just not the pin


-----------------------------------------------
Wooden Mendel
Teacup Firmware
emt
Re: Have I got FiveD on Arduino config.h wrong?
January 24, 2011 06:59AM
Hi

Sorry for the hassle of this. I really appreciate the work that you are doing.

I thought I had the ampersands correct.

I attach my config.h file.

I appear to have every thing working correctly except the heater.........


Regards

Ian
Attachments:
open | download - config.h (17.9 KB)
Re: Have I got FiveD on Arduino config.h wrong?
January 24, 2011 08:46PM
ah, I see your problem, timer 3 is a 16-bit timer, whereas the heater is expecting an 8-bit register. Provide &OCR3CL, but you'll have to change the initialisation in mendel.c too. We want fast pwm, 8 bit, which according to the datasheet requires the following changes:

diff --git a/mendel.c b/mendel.c
index e36387d..a05909b 100644
--- a/mendel.c
+++ b/mendel.c
@@ -82,24 +82,24 @@ void io_init(void) {
        OCR2B = 0;
 
        #ifdef  TCCR3A
-               TCCR3A = MASK(WGM31) | MASK(WGM30);
-               TCCR3B = MASK(CS30);
+               TCCR3A = MASK(WGM30);
+               TCCR3B = MASK(WGM32) | MASK(CS30);
                TIMSK3 = 0;
                OCR3A = 0;
                OCR3B = 0;
        #endif
        
        #ifdef  TCCR4A
-               TCCR4A = MASK(WGM41) | MASK(WGM40);
-               TCCR4B = MASK(CS40);
+               TCCR4A = MASK(WGM40);
+               TCCR4B = MASK(WGM42) | MASK(CS40);
                TIMSK4 = 0;
                OCR4A = 0;
                OCR4B = 0;
        #endif
        
        #ifdef  TCCR5A
-               TCCR5A = MASK(WGM51) | MASK(WGM50);
-               TCCR5B = MASK(CS50);
+               TCCR5A = MASK(WGM50);
+               TCCR5B = MASK(WGM52) | MASK(CS50);
                TIMSK5 = 0;
                OCR5A = 0;
                OCR5B = 0;

This is from me copying+pasting initialisations for smaller timers and not testing on a 'mega. I'll push this to the repository when I've done some documentation.


One other thing: the heater index for your temp sensor should be set to 0 if you want closed-loop control!
255 (actually anything >= NUM_HEATERS) means no associated heater, just a lone temp sensor.


-----------------------------------------------
Wooden Mendel
Teacup Firmware
emt
Re: Have I got FiveD on Arduino config.h wrong?
January 25, 2011 12:20PM
Many thanks again.

I have made the changes you show.

I also altered heater index to 0

Make now compiles cleanly.

I can control all the axes from miniterm and get the response I expect. The thermistor is responding to heat from a hot air gun. The only thing not working at the moment is the extruder heater. The command I use is M104 Snnn.

I guess I still have something wrong in the config.h or makefile. I know the electronics are OK as the heater works with the standard firmware.

Will debug help me and how do I turn it on? My makefile contains DEFS = "-DDEBUG=1"
Do I have to change the number to get more information?


Regards

Ian
Re: Have I got FiveD on Arduino config.h wrong?
January 25, 2011 05:56PM
I think debug can be defined in your config. Once defined, you can turn various bits on and off with some M-codes. I think DEBUG_PID will help you with your heater stuff. Probably needs to be documented a bit better, I'm sure you'll figure it out until then


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Have I got FiveD on Arduino config.h wrong?
January 26, 2011 01:02PM
I just went through this exorcise and what i found was the eeprom settings fro PID were not getting set as described in the other thread. I currently have to manually issue the proper M codes to set the PID values and then my Heater controls began functioning correctly.
-trout
emt
Re: Have I got FiveD on Arduino config.h wrong?
January 27, 2011 12:46PM
Thanks Architect

I can't find any reference to PID not setting in the other thread. Can you give me a link please. What would be a good set of values to start with and what can the range of values be? I am right that these are set with M130 Snnn for P and M131 Snnn for I etc.


Regards

Ian
Re: Have I got FiveD on Arduino config.h wrong?
January 27, 2011 02:47PM
Architect Wrote:
-------------------------------------------------------
> I currently
> have to manually issue the proper M codes to set
> the PID values and then my Heater controls began
> functioning correctly.
> -trout

Do you have to do this every time you power up your Arduino? I had this porblem too, but once I had set the PID values I used m134 (I think) to write the values to the eeprom. Now the setting remian through a power cycle.

>I can't find any reference to PID not setting in the other thread. Can you give me a link please.

Start here, it carries on for a few posts and there may be some other posts in between but all the info is there.

Edited 1 time(s). Last edit at 01/27/2011 07:05PM by spaztik.
Re: Have I got FiveD on Arduino config.h wrong?
February 02, 2011 08:30AM
hello
I'va a question about config.h

DEFINE_TEMP_SENSOR(extruder,  TT_INTERCOM,    0,           255)

my thermistor is connected to Analog pin 1, closed loop with heater defined on
#define DEFINE_HEATER(extruder, PORTD, PIND6, OCR0A)

I've try both :
#define DEFINE_TEMP_SENSOR(extruder,TT_THERMISTOR,AI01,0)

and

#define DEFINE_TEMP_SENSOR(extruder,TT_THERMISTOR,1,0)

I allays get an error compilling

"config.h:248:52: erreur: « 0 » peut ne pas apparaître parmi les paramètres de macros"
or
"config.h:248:52: erreur: « 1 » peut ne pas apparaître parmi les paramètres de macros"

(approx translation of the error message :
..."1" can't appears in parameters of macro"


I don't really understand :
-the pin is the number of termistor pin, in wich form ?
-the name 'extruder' is an exemple or is usable directly ?


thanks


about setting correct values to PID
the Ziegler Nichols_method is quite simple
emt
Re: Have I got FiveD on Arduino config.h wrong?
February 02, 2011 11:18AM
Spaztic

Many belated thanks, been off line the last few days.


Regards

Ian
Sorry, only registered users may post in this forum.

Click here to login