Issues with FlowCode vs Arduino/(Funduino)

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Alberta2012
Flowcode v5 User
Posts: 63
Joined: Fri Apr 19, 2013 2:18 am
Has thanked: 10 times
Been thanked: 14 times
Contact:

Issues with FlowCode vs Arduino/(Funduino)

Post by Alberta2012 »

Hi Everyone,

I want to use Flowcode (V5) with an Arduino(NANO)-compatible module (Funduino)

I tried everything I could find on that forum (including David's guide) and finally, finally ended-up being able to communicate. I downloaded every files that was suggested in the different topics....

I still have some issues: with my configuration that works, FC won't compile the .Hex file needed to download ....if it's the first time that I compile, I won't create an HEX file at all. If the file has already been compiled previously, it won't update it...

So the solution is : Load default config, compile to HEX, load working config, download to Arduino ..... Pain you know where !

here are the settings:
Default:
Compiler:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avra.bat
%t "%D\%f.elf" "%D\%f.c" "%D\%f.lst"

Linker:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrb.bat
"%D\%f.elf" "%D\%f.hex" "%D\%f.cof"

Programmer:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrc.bat
AVRDUDE %a %t "%D\%f.hex" "%f.hex" %cfg %c0 %c1 %c2 %c3

C:\Program Files\Flowcode(AVR)\v5\Tools\PPP\PPPv3.exe
-cs 2 -chip %p -config

Working (for download)
Compiler:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrc_arduinoA.bat
%a stk500 com4 57600 "%f.hex"

Linker:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrb.bat
"%D\%f.elf" "%D\%f.hex" "%D\%f.cof"

Programmer:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrc_arduinoA.bat
%a stk500 com4 57600 "%f.hex"

C:\Program Files\Flowcode(AVR)\v5\Tools\PPP\PPPv3.exe
-cs 2 -chip %p -config

Now, is there someone that can pin-point what my problem might be ?

Furthermore: if someone understand what each of these settings means or should be, please let me know... right now, when I change something, it's always trial&error...And when it works, I have no clue why ! The help for Flowcode is not impressive either....

I haven't tried with my UNO yet ....

Thanks in advance !

Jasmin

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Issues with FlowCode vs Arduino/(Funduino)

Post by dazz »

Hi Jasmin
Your compiler settings are wrong
Unzip the attached file to your desktop, open flowcode, go to build then compiler options then import browse to the file on your desktop once imported click the save icon.
then check the paths are correct for your version of windows
lastly make sure the com port in the programmer options is correct

Regards
Dazz
Attachments
nano.zip
(360 Bytes) Downloaded 509 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Alberta2012
Flowcode v5 User
Posts: 63
Joined: Fri Apr 19, 2013 2:18 am
Has thanked: 10 times
Been thanked: 14 times
Contact:

Re: Issues with FlowCode vs Arduino/(Funduino)

Post by Alberta2012 »

Hi Dazz

The way I see it, you've combined the "default" compiler portion to the "working" programmer portion....

any chance that you can briefly explain what all these parameters mean ?

what are avra.bat or avrc_arduinoA.bat doing ???

It is my understanding that the compiler take care of "converting" the flowcode into a language such as 'c' , and that the programmer take the code and push it to the chip.

What is the "linker/assemble doing ? Converting 'c' into assembler language ?

Now, if all the above statements are correct, why do we have to use STK500 ? Would AVRdude be able to do the same ? what is the advantage of one over the other ?

Thanks again ! I will try the config after work tonight !

Jasmin

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Issues with FlowCode vs Arduino/(Funduino)

Post by dazz »

Hi Jasmin
The default options are for use with the atmel avr(genuine tool) programmer, the compiler options are customisable so the user can choose which programmer to use. if the following reply seems too simplistic then i apologize beforehand

The compiler tab links to the compiler used to convert the flowchart to a C file, as avrdude is used the avra.bat file simply links to the gcc compiler with predefined parameters to convert the code, the parameters bit (%t "%D\%f.elf" "%D\%f.c" "%D\%f.lst") creates other files in this case the elf, C and Lst files (for more info look up gcc.exe command line parameters in google)

The linker tab then converts the Files created to Asm and hex and also creates a cof file( i think the cof is for use with icd ) again the parameters ,tells avrdude what files to create the avrb.bat again just links everything together
you will notice that the avra and avrb batch files are used for both the genuine avr programmer and the arduino, this is because its what the standard avr tool chain looks for.

The programmer tab is where the main differences lie and this is where the most confusion comes in the avrc file is the one that has the options set to use the standard avr programmer, but as the arduino has its own bootloader and the fuses dont need changing etc we uses the avrc_arduinoA.bat file as this has all the internal parameters required to set up avrdude for programming
the parameters in the programer bit %a stk500 com4 57600 "%f.hex" these simply tell avrdude its using the stk500 protocol(arduino standard) com4 (needs to be set where your arduino is connected) 57600(baud for programming) "%f.hex" (loads the current or new hex file)

Yes AvrDude can do the same in fact it is, but by using the avrc_arduinoA.bat file all the guesswork is taken out of setting up avrdude.

As an example when it works with your nano to change it to work with the uno all you would need to do is in the name field in the programmer section change Nano to Uno and in the parameters change 57600 to 115200 , change the com port to the one your uno is using click the save icon then in the drop down box you will have a Nano entry and a Uno entry, correctly configured to program each board.

As you can see doing it this way means once you work it out it takes very few changes to add a different programming board
Hope it makes sense

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Issues with FlowCode vs Arduino/(Funduino)

Post by dazz »

Hi
I will post a bit more tomorrow as its a bit late now and my concentrations going

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Alberta2012
Flowcode v5 User
Posts: 63
Joined: Fri Apr 19, 2013 2:18 am
Has thanked: 10 times
Been thanked: 14 times
Contact:

Re: Issues with FlowCode vs Arduino/(Funduino)

Post by Alberta2012 »

Dazz: Man I like it when it's explained properly !!! Which is what you did !

I don't really need to go deep in details, as long as I get a rough idea !

I'm sure a lot of other people will appreciate that post : you've remove a lot of mistery from those settings !

Thanks again !

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Issues with FlowCode vs Arduino/(Funduino)

Post by dazz »

HI Jasmin
Another quick explanation for some of the bits i didnt explain very well


HI Jasmin if you look at the differences in your first post

Programmer:
C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrc.bat
AVRDUDE %a %t "%D\%f.hex" "%f.hex" %cfg %c0 %c1 %c2 %c3

C:\Program Files\Flowcode(AVR)\v5\Tools\PPP\PPPv3.exe
-cs 2 -chip %p -config



C:\Program Files\Flowcode(AVR)\v5\Tools\MX_bats\avrc_arduinoA.bat
%a stk500 com4 57600 "%f.hex"

C:\Program Files\Flowcode(AVR)\v5\Tools\PPP\PPPv3.exe
-cs 2 -chip %p -config

heres what each does
avrc.bat
AVRDUDE %a %t "%D\%f.hex" "%f.hex" %cfg %c0 %c1 %c2 %c3

Looking at this line its calling avrdude loading the hex and then the %cfg %c0 %c1 %c2 %c3 part is loading the fuses, this is required when using standalone AVR micros

avrc_arduinoA.bat

%a stk500 com4 57600 "%f.hex"
Where this bat file differs is we don't need to call avrdude in the parameters or set up fuses as this is done in the bat file, all we need to tell it is to emulate the STK500 where to find the arduino, what speed to programme and what hex to load
The fuses are set in the arduinos and cannot be changed(or it would trash the bootloader).


Another thing to remember is Flowcode references arduino pins the AVR way not the Arduino way, a lot of confusion arises when trying to use components like the pwm's as in Arduino speak you would set up a pwm by naming the pin, but in Flowcode pwm's are numbered as they appear on the datasheet, you will also notice some pins are missing in the chip view this is because not all pins are available for use on the arduino's If you get stuck just holler
i really need to go to bed now :lol:
Oh and let us know if the amended settings work with your funduino, if not pop up a link to the datasheet and i will try and sort it tommorow
Regards

Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply