Page 1 of 1

Problems using ATmega324

Posted: Sun Nov 18, 2012 4:48 pm
by TomasS
Hi

I've made a controller board and are planning on using an ATmega324A-PU but somehow I cannot program it.

I have tried choosing both the ATmega324: here I get the error:
"Flowcode was out of position to compile the flowchart's C code due to the following error:
If your flowchart contains C code, review it carefully. If your flowchart contains C code and you really have reviewed the code, contact Technical"

and the ATmega324P: and getting the error:

"Flowcode was not in the position to transfer the flow chart for the microprocessor. Check program options and the physical connections."

I have compiled my program to an ATmega16 without any problems.

Should't I be able to use the ATmega324A-PU together with Flowcode?

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 5:01 pm
by JohnCrow
Hi

Ive got a couple of the AVRMega 324P 20PU devices
If you want to post your flowchart or PM it to me I can see if I can program it on my system.

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 5:28 pm
by TomasS
Hi John

Thanks. It's just as simple as it gets. Running LED's on all 4 ports just to test if all connections is OK and the controller is running.

Perhaps I can ask you a second question?
I have a 20x4 LCD connected as well where the connections is done like this:

LCD___________ATmega
DB4 - DB7______PORT C4-C7
RS____________PORT C0
R/W__________Connected to GND
EN____________PORT C2

Should this be a problem in Flowcode? It works using the compiler Code Vision (Here R/W is connected to C1)
The controller is running 16MHz.

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 7:03 pm
by Enamul
Hi
I have tried your posted code and it compiles fine as you said. Can you post your program with LCD please so that we can see?

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 7:17 pm
by TomasS
Enamul wrote:Hi
I have tried your posted code and it compiles fine as you said. Can you post your program with LCD please so that we can see?
Hi Enamul

Have you done this on an ATmega324A-PU with success?

Meanwhile I have tried trimming the clock frequency and got the LCD working!
But only using a mega16.

BR
Tomas

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 7:28 pm
by JohnCrow
Hi Tomas

Ive just tried you program on my programmer with the Mega 324P device
It loads into the device with no problems,
The program runs all ok on hardware as well as simulation.
RunningLED-324.fcf_avr
(13 KiB) Downloaded 433 times

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 7:35 pm
by Enamul
Have you done this on an ATmega324A-PU with success?
Yes I have tried in ATmega324P

Re: Problems using ATmega324

Posted: Sun Nov 18, 2012 7:58 pm
by TomasS
Enamul wrote:
Have you done this on an ATmega324A-PU with success?
Yes I have tried in ATmega324P
OK - Thanks - But unfortunately the chips I have is ATmega324A-PU. Compiling and downloading to ATmega324P worked, but not the ATmega324A-PU :(

Re: Problems using ATmega324

Posted: Mon Nov 19, 2012 12:44 am
by Enamul
Hi
Can you post compiler msg please? I am facing similar problem. I want to check whether is that same or not.

Re: Problems using ATmega324

Posted: Mon Nov 19, 2012 12:41 pm
by TomasS
Enamul wrote:Hi
Can you post compiler msg please? I am facing similar problem. I want to check whether is that same or not.
Hi Enamul

I get these errors:

ATmega324: here I get the error:
"Flowcode was out of position to compile the flowchart's C code due to the following error:
If your flowchart contains C code, review it carefully. If your flowchart contains C code and you really have reviewed the code, contact Technical"

ATmega324P: and getting the error:

"Flowcode was not in the position to transfer the flow chart for the microprocessor. Check program options and the physical connections."

Re: Problems using ATmega324

Posted: Mon Nov 19, 2012 3:00 pm
by dazz
Hi tomas
firstly what programmer are you using to transfer your code to the uc
can you send a progam to you uc using another software just a blinky will do for a test
Can you also try to compile to hex and see if it generates the hex file
also can you post the msg.txt file that is generated

Regards
Dazz

Re: Problems using ATmega324

Posted: Tue Nov 20, 2012 6:55 pm
by TomasS
dazz wrote:Hi tomas
firstly what programmer are you using to transfer your code to the uc
can you send a progam to you uc using another software just a blinky will do for a test
Can you also try to compile to hex and see if it generates the hex file
also can you post the msg.txt file that is generated

Regards
Dazz
Hi Dazz
I am using the ISP MK II programmer - I have previously used different AVR controllers - all programmed through the MK II and there hasn't been problems like the one I'm experiencing at the moment with the ATmega324A-PU.
I just did a simple blinker program, but the same problem occurs.
I can do a compilation to HEX and a COFF file as well, but when the programmer is launched the success ends.
I have attached the msg.txt file as you requested :)

BR
Tomas

Re: Problems using ATmega324

Posted: Tue Nov 20, 2012 7:29 pm
by dazz
A quick and very dirty fix is this
in your flowcode folder in tools go to the AVRDUDEusb folder
create another folder called BACK and in to this place your original avrdude.conf file
then unzip the attached file into the AVRDUDEusb folder, and try again let me know how you get on if it works theres any easyway to cure it

Regards
Dazz
avrdude.zip
(19.71 KiB) Downloaded 332 times

Re: Problems using ATmega324

Posted: Tue Nov 20, 2012 8:25 pm
by TomasS
dazz wrote:A quick and very dirty fix is this
in your flowcode folder in tools go to the AVRDUDEusb folder
create another folder called BACK and in to this place your original avrdude.conf file
then unzip the attached file into the AVRDUDEusb folder, and try again let me know how you get on if it works theres any easyway to cure it

Regards
Dazz
avrdude.zip
Amazing! That did the trick.
What has changed?

BR.
Tomas

Re: Problems using ATmega324

Posted: Tue Nov 20, 2012 8:38 pm
by dazz
Hi
I just changed the signature in the conf file,(follow below to add the pu entry into conf) open it and search for 324, you will see the signature part ends with 15 (the original ends with 08). to cure it permanently copy the entry for the 324 and paste it below itself in the conf file, change the 324p sig back to 08, then change the newly pasted bit from

Code: Select all

part
    id               = "m324p";
    desc             = "ATMEGA324P";
    has_jtag         = yes;
#   stk500_devcode   = 0x82; # no STK500v1 support
#   avr910_devcode   = 0x?;  # try the ATmega16 one:^
    avr910_devcode   = 0x74;
    signature        = 0x1e 0x95 0x15;
change it to

Code: Select all

part
    id               = "m324pU";
    desc             = "ATMEGA324PU";
    has_jtag         = yes;
#   stk500_devcode   = 0x82; # no STK500v1 support
#   avr910_devcode   = 0x?;  # try the ATmega16 one:^
    avr910_devcode   = 0x74;
    signature        = 0x1e 0x95 0x15;
Then go to your FCD folder in flowcode open the ATMEGA324P.fcd file find this part

Code: Select all

DefaultPackageType=0
FlowcodeProduct=AVR
ChipName=atmega324p
AltChipName=m324p
FlashSize=32768
RamSize=2048
and change it to

Code: Select all

DefaultPackageType=0
FlowcodeProduct=AVR
ChipName=atmega324pU
AltChipName=m324pU
FlashSize=32768
RamSize=2048
then select saveas ATMEGA324PU
restart flowcode and you will see the 324pu as aseperate chip now.
then if alls gone well you should be able to program as normal

let us know how you get on

Regards
Dazz

Re: Problems using ATmega324

Posted: Tue Nov 27, 2012 9:40 am
by TomasS
Hi Duzz

It works now!
I had some problems getting it to work - I didn't see, the FCD file got the .txt extension, when I saved it :( But WinCommander solved this problem :)

Thanks!

Re: Problems using ATmega324

Posted: Wed Nov 28, 2012 1:51 pm
by dazz
Thanks for letting us know :)


Regards
Dazz

Re: Problems using ATmega324

Posted: Mon Dec 03, 2012 9:40 pm
by TomasS
Hello again

The recognition of the ATmega324pU doesn't seem to work after all :(
I now get a compilation error that says: "unknown MCU 'atmega324pu' specified"
I cannot find the error, since I did as you described.

I have attached the files you described, together with the .msg file. Perhaps another pair of eyes can find the error?

BR
Tomas

Re: Problems using ATmega324

Posted: Mon Dec 03, 2012 9:42 pm
by TomasS
Content of conf-file:

#------------------------------------------------------------
# ATmega324PU
#------------------------------------------------------------

# similar to ATmega164P

part
id = "m324pU";
desc = "ATMEGA324PU";
has_jtag = yes;
# stk500_devcode = 0x82; # no STK500v1 support
# avr910_devcode = 0x?; # try the ATmega16 one:^
avr910_devcode = 0x74;
signature = 0x1e 0x95 0x08;
pagel = 0xd7;
bs2 = 0xa0;
chip_erase_delay = 9000;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";

chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
"x x x x x x x x x x x x x x x x";

timeout = 200;
stabdelay = 100;
cmdexedelay = 25;
synchloops = 32;
bytedelay = 0;
pollindex = 3;
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
pollmethod = 0;

pp_controlstack =
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
hventerstabdelay = 100;
progmodedelay = 0;
latchcycles = 5;
togglevtg = 1;
poweroffdelay = 15;
resetdelayms = 1;
resetdelayus = 0;
hvleavestabdelay = 15;
chiperasepulsewidth = 0;
chiperasepolltimeout = 10;
programfusepulsewidth = 0;
programfusepolltimeout = 5;
programlockpulsewidth = 0;
programlockpolltimeout = 5;

idr = 0x31;
spmcr = 0x57;
allowfullpagebitstream = no;

memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
size = 1024;
min_write_delay = 9000;
max_write_delay = 9000;
readback_p1 = 0xff;
readback_p2 = 0xff;
read = " 1 0 1 0 0 0 0 0",
" 0 0 x x x a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";

write = " 1 1 0 0 0 0 0 0",
" 0 0 x x x a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";

loadpage_lo = " 1 1 0 0 0 0 0 1",
" 0 0 0 0 0 0 0 0",
" 0 0 0 0 0 0 a1 a0",
" i i i i i i i i";

writepage = " 1 1 0 0 0 0 1 0",
" 0 0 x x x a10 a9 a8",
" a7 a6 a5 a4 a3 a2 0 0",
" x x x x x x x x";

mode = 0x41;
delay = 10;
blocksize = 128;
readsize = 256;
;

memory "flash"
paged = yes;
size = 32768;
page_size = 128;
num_pages = 256;
min_write_delay = 4500;
max_write_delay = 4500;
readback_p1 = 0xff;
readback_p2 = 0xff;
read_lo = " 0 0 1 0 0 0 0 0",
" 0 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";

read_hi = " 0 0 1 0 1 0 0 0",
" 0 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";

loadpage_lo = " 0 1 0 0 0 0 0 0",
" 0 0 x x x x x x",
" x x a5 a4 a3 a2 a1 a0",
" i i i i i i i i";

loadpage_hi = " 0 1 0 0 1 0 0 0",
" 0 0 x x x x x x",
" x x a5 a4 a3 a2 a1 a0",
" i i i i i i i i";

writepage = " 0 1 0 0 1 1 0 0",
" 0 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 x x x x x x",
" x x x x x x x x";

mode = 0x21;
delay = 6;
blocksize = 256;
readsize = 256;
;

memory "lock"
size = 1;
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x x x o o o o o o";

write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
min_write_delay = 9000;
max_write_delay = 9000;
;

memory "lfuse"
size = 1;
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x o o o o o o o o";

write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
"x x x x x x x x i i i i i i i i";
min_write_delay = 9000;
max_write_delay = 9000;
;

memory "hfuse"
size = 1;
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";

write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
"x x x x x x x x i i i i i i i i";
min_write_delay = 9000;
max_write_delay = 9000;
;

memory "efuse"
size = 1;

read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";

write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x 1 1 1 1 1 i i i";
min_write_delay = 9000;
max_write_delay = 9000;
;

memory "signature"
size = 3;
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
"x x x x x x a1 a0 o o o o o o o o";
;

memory "calibration"
size = 1;

read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
;

Re: Problems using ATmega324

Posted: Thu Dec 06, 2012 2:39 pm
by dazz
Hi Tomas
played with it all day yesterday and could not figure it out, for now just change the signature in the conf file to 15 for the pu as when it worked.
if i can figure out how to add it to the conf file i will, tried changing the io.h and adding a def file but still did not work(in avrdude)