Page 1 of 2

PB with MACRO on Flowcode 5 AVR pro

Posted: Mon Jul 23, 2012 11:54 am
by yann.cosson
Hello,

I made a little simple prog just to test Flowcode Macro Function :
first step i countdown 0x0F to 0x00,and light 4 led with the value of the countdown, in a MACRO.
when i arrive at 0x00 value i quit the MACRO and,
after i just make a K2000 with 8 led on the same port (port A for ATmega128, port D for ATmega328P).

on a ATmega128 card :
The soft start, and countdown 0x0F to 0x00, but after instead of quit the macro and start K2000, the MACRO start again and again and.....
i never have my K2000

on a ATmega328P card :
It works perfect, countdown in a macro, and after K2000

I flash the same prog in both card (1 card with ATmega128A (ref STK128+); 1 card with ATmega328P (a Arduino card without boot)),
i just adapt the port of the led that are plugged on the boards.

i send you my 2 workspaces, and i hope you can help me, because i buy Flowcode last week, and i have no idea of what i have done wrong.
the same flowcode project works on a card and doesn't on another, i'm out of idea.

Thanks for the help you can give to me.

Best regards, YANN.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Mon Jul 23, 2012 1:47 pm
by Benj
Hi Yann,

Sounds like maybe the watchdog timer is enabled on the ATmega128 board. What happens if you say light an LED, wait a delay, switch off the LED and then enter a while 1 loop. Does the LED keep flashing?

Another thing I spotted is that the variable "i" is only a byte and so cannot be used to count up to 2000. I may have the wrong end of this stick with this but switching the variable type to INT in the variable manager may help to solve the issue.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sat Jul 28, 2012 5:41 pm
by yann.cosson
I try to "play" with WDTON on the ATMEL STUDIO PROGRAMMING PAGE.
By default the WDTON is uncheck, but i check and uncheck and prog with my jtag, and it still doesn't work.

I have made 4 flowcode prog :

- µP ATmega328P, Arduino Uno card, without MACRO : OK
- µP ATmega328P, Arduino Uno card, with MACRO : OK
- µP ATmega128A, STK128+ card, without MACRO : OK
- µP ATmega128A, STK128+ card, with MACRO : NOK :(

My prog make a Countdown 0xFF to 0x00, and i "screen" the binary value on 8 LED on portA for ATmega128 and portD for ATmega328
and after i make a K2000 with the 8 LED (light led one by one, with rightshift, and leftwshift, you will probably remenber David Haselof in K2000 (knight rider)).

My first prog was counting down 0x0F to 0x00 and it's doing the same (if there was a watchdog timer PB, it will reset before the end of the countdown).

So just to resume :
Countdown 0x0F to 0x00 or countdown 0xFF to 0x00 doing the "same".
When i put it in a MACRO it never get out the MACRO on my ATmega128.
it's look like my MACRO is the main, and never go in my main.

I put in PJ my 4 project, and i hope someone can help me because i'm really out of ideas.

PS : to disable watchdog, do i have only to unfuse WDTON ?

Best regards, YANN.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sat Jul 28, 2012 5:42 pm
by yann.cosson
good one file 2/4

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sat Jul 28, 2012 5:42 pm
by yann.cosson
good one file 3/4

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sat Jul 28, 2012 5:43 pm
by yann.cosson
good one file 4/4

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sat Jul 28, 2012 6:07 pm
by yann.cosson
NOW I AM SURE OF IT..................

THERE IS A BUG IN FLOWCODE 5 AVR PRO


i have a friend that have flowcode 4 avr

we have with his flowcode 4 avr, make exactly the same flowcode prog with macro, and build the flowchart...for my atmega128
with my jtag, my stk128+ card, and with atmel studio 6, we flash my card.

and it works perfect, countdown in a macro, and after k2000 in the main.


the same flowcode prog work perfect with flowcode 4 and doesn't work with flowcode 5.


please can you fix that bug.

thanks for all, yann.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sat Jul 28, 2012 8:51 pm
by kersing
Would you mind switching the CAPS lock off? There is no need to yell...

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sun Jul 29, 2012 6:42 am
by yann.cosson
OK done CAPS lock off.
But yesterday i was really :evil: :evil: :evil: :evil:
I'm searching since about 15 days of the why it doesn't work.....

I send my flowchart for Flowcode v5 avr, the one that doesn't work.
The same on v4 works perfect.
All parameters are all by default, we don't change anything of the flowcode parameters.

Best Regards, Yann.

PS : Sorry for the yesterday post but i was really very :evil: :evil: :evil: :evil: about that.....

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Sun Jul 29, 2012 10:48 pm
by DavidA
Hello Yann,

I will look at this tomorrow for you

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Mon Jul 30, 2012 4:35 pm
by DavidA
Hello Yann,

I have just tested this on a 324P, unfotunately i do not have a 128 to test this on, but on this chip the program works completely fine both v5 and v4, do you have another chip you can test this on?

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Mon Jul 30, 2012 7:30 pm
by yann.cosson
Hello DavidA,

As i said on my first post :

With a ATmega328P it works perfect.

With a ATmega128 it doesn't work with Flowcode v5, but it works with Flowcode v4 (exactly the same flowchart, but one made on v4 and one made on v5).

I can send you the C code of Flowcode v4 and v5, and the lst file of v4 and v5, of my prog.

I saw many differences between the 2 files, and there are more declaration on v5 than on v4.
Perhaps one of them is not good for ATmega128.

YANN.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Mon Jul 30, 2012 9:15 pm
by yann.cosson
i made a little modification to see if it was my flowchart style that was wrong, but it still doesn't work :(

i make a main, in which there is a while 1, and i use 2 macros, one for LED<<1, and one for LED>>1.

with Flowcode v5, there is only the first macro that "starts and works", i have LED<<1, and LED<<1, and LED<<1, etc.........
the prog never go to the second macro LED>>1

with Flowcode v4, it works perfect, LED<<1, and after LED>>1, and after LED<<1, and after LED>>1, etc......
in fact i have the same thing on flowcode v4 simu, and on my card ;)
but with v5, i haven't, snif snif.

Yann.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 9:57 am
by DavidA
Hello Yann,

Could you send me the v4 c code/fcf you have for the ATMEGA128.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 10:56 am
by yann.cosson
here is the C code made by FCD v4
I add the Hex too

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 10:57 am
by yann.cosson
here is the C code made by FCD v5, with the same Flowchart
I add the Hex too

Thx for All. :D

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 1:08 pm
by DavidA
Hello Yann,

Can you also post me the "asm" files which are created, as this is probably going to be the problem area, they need to be identical programs in v4 and v5 and compiled on the same computer if possible please.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 2:20 pm
by yann.cosson
where is the asm file because in the workspace rep there is one file with :
- .c
- .cof
- .elf
- .fcf_avr
- .fcf_avr.001
- .fcf_avr.v31
- .hex
- .lst
- .msg.txt


i thought that the asm file was the one with extension .lst, and i send them in the rar file, post before.

Yann. :D

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 3:05 pm
by DavidA
Hello Yann,

(My mistake im used to dealing with PIC files which have ASM files, i know v little about AVR)

As I am unable to recreate this here, as we have no ATMEGA128 i will have to ask you to confirm the issue you are having by running the attached program on your hardware, you may need to change clock settings.

This will light one LED to start, jump into a macro, light a seperate LED and then jump out and light another, if i understand your issue correctly, this should not work as it will never leave the macro.

Can you run this program, and tell me exactly when it is failing.

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 3:29 pm
by yann.cosson
ok i will try this as soon as i'll be at my home.

i tell you back what's going wrong and how the prog work.

I think asm file is the lst one for avr, so i send you my lst file of v5, the one that doesn't work.
in this lst file there are many asm command, so i think this is the one.

Yann :D

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Tue Jul 31, 2012 8:52 pm
by yann.cosson
I try your debug.fcf_avr and when you see the simu on flowcode the LED A7 bright, and after A6 and after A5,
It's correct, no ?

But on my card, the LED A7 set on and off, and after LED A6 set on and off, but after :( LED A7 bright again, and after A6, etc ......, A7, A6, A7, A6, .....

A5 never get on

Yann, :D

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Wed Aug 01, 2012 7:36 am
by yann.cosson
Hello,

good morning,

I have a little theory to ask about the PB.
it's look like the µC start the main, make init and things like that, do the prog, and after arrive to a macro.
he go in the macro, do what is programed in the macro, but at the end of the macro instead of keep on where he leave the main, he see the end of the macro and take it for the end of the main, so he start again the main, etc.....

i don't know if it is true, but it seems to do this.

Best regards,

Yann, :D

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Wed Aug 01, 2012 10:23 am
by DavidA
Hello Yann,

We have analysed the ASM code from a simple LED flasher for both v4 and v5 with the ATMEGA128, and it seems to be identical, which is causing us some issues, can you please try the following two flasher programs, one is v4 and one is v5, and send me the lst files for both and a description as to where the program is failing in the v5 version.

Thanks,

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Wed Aug 01, 2012 2:59 pm
by Spanish_dude
yann.cosson wrote:I try your debug.fcf_avr and when you see the simu on flowcode the LED A7 bright, and after A6 and after A5,
It's correct, no ?

But on my card, the LED A7 set on and off, and after LED A6 set on and off, but after :( LED A7 bright again, and after A6, etc ......, A7, A6, A7, A6, .....

A5 never get on

Yann, :D
From this I'd say the watchdog timer is enabled, if there is one on AVR controllers ?
Nicolas

Re: PB with MACRO on Flowcode 5 AVR pro

Posted: Wed Aug 01, 2012 3:16 pm
by yann.cosson
there is a watchdog timer on ATmega128, but he is disable.

And why if there is a watchdog timer, when you make exactly the same flow, but one with macro and another all in the same main, the one that is in the same main work perfect, and the one with macro doesn't.
If the watchdog timer was enable, macro or not, the prog should do the same no ?

Yann, :D