PB with MACRO on Flowcode 5 AVR pro

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

PB with MACRO on Flowcode 5 AVR pro

Post 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.
Attachments
Yann_workspace_flowcode_5_AVR.rar
2 workspace, 1 for ATmega128A and 1 for ATmega328P
(25.99 KiB) Downloaded 332 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.
Attachments
ATmega128 - K2000 avec macro.rar
bad one
(171.62 KiB) Downloaded 334 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by yann.cosson »

good one file 2/4
Attachments
ATmega128 - K2000 sans macro.rar
(178.88 KiB) Downloaded 301 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by yann.cosson »

good one file 3/4
Attachments
ATmega328P - K2000 avec macro.rar
(165.96 KiB) Downloaded 326 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by yann.cosson »

good one file 4/4
Attachments
ATmega328P - K2000 sans macro.rar
(170.63 KiB) Downloaded 312 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.
Last edited by yann.cosson on Sun Jul 29, 2012 6:21 am, edited 1 time in total.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by kersing »

Would you mind switching the CAPS lock off? There is no need to yell...
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.....
Attachments
ATmega128 - K2000 avec macro__flowcode v5.rar
works on v4 and doesn't on v5
(7.06 KiB) Downloaded 310 times

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by DavidA »

Hello Yann,

I will look at this tomorrow for you

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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?

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.
Attachments
120730_K2000_UP and DOWN_avec macro.fcf_avr
(15.5 KiB) Downloaded 187 times

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by DavidA »

Hello Yann,

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

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post by yann.cosson »

here is the C code made by FCD v4
I add the Hex too
Attachments
ATmega128_FCD v4.rar
(1.63 KiB) Downloaded 193 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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
Attachments
ATmega128_FCD v5.rar
(2.23 KiB) Downloaded 181 times

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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.
Attachments
debug.fcf_avr
(10 KiB) Downloaded 219 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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
Attachments
120730_K2000_UP and DOWN_avec macro_lst file.rar
(2.88 KiB) Downloaded 194 times

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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,
Attachments
FlasherTest_v5.fcf_avr
(13.4 KiB) Downloaded 214 times
FlasherTest_v4.fcf_avr
(5 KiB) Downloaded 206 times

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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

yann.cosson
Posts: 52
Joined: Thu Jul 12, 2012 9:23 pm
Has thanked: 5 times
Contact:

Re: PB with MACRO on Flowcode 5 AVR pro

Post 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

Post Reply