I have a 3V 8Mhz Arduino Pro Micro clone that is fitted with an Atmega32u4 processor. The only Target option within flowcode that allows me to program the device is the ‘Arduino LilyPad Usb’. However, the LilyPad Usb target has the clock speed set to 16MHz by default with no ability to change it from within the General Options tab / Options menu.
By running a 1Hz flasher test program I confirmed a 2s ON time and 2s OFF time, which indicates Flowcode is set to 16Mhz and therefore the program is running at half speed.
I have attempted to change the clock frequency by inserting an OSCCON statement into a C Code block at the start of the 1Hz flasher program but this flags an OSCCON undeclared error when compiling.
I have also tried using the ‘Arduino Micro 8MHz’ target but this will not compile to my Arduino Pro Micro clone.
Searching the forum posts has not provided an answer, therefore I wonder if some kind soul can point me in the right direction, by advising how to set the clock frequency in Flowcode for a clone Arduino device running on an 8MHz external crystal oscillator?
Thanks in advance.
Change clock frequency in Flowcode to match Arduino hardware [Solved]
Moderator: Benj
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: Change clock frequency in Flowcode to match Arduino hardware
As a temporary fix you can edit the definition file.
Assuming you are using v8 - it is in
C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\ARD
Make a backup copy of Arduino Lilypad Usb.fcdx
Then edit it (the original) (notepad, notepad++) - and change
Note if you use notepad to edit it likes to save with a .txt extension (which you don't want)
Martin
Assuming you are using v8 - it is in
C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\ARD
Make a backup copy of Arduino Lilypad Usb.fcdx
Then edit it (the original) (notepad, notepad++) - and change
to<clock max_speed="16000000"
master_divider="1"
fixed="16000000" />
There is also a 'default' copy of the fcdx file (in C:\Program Files (x86)\Flowcode v8\DefaultData\FlowcodeV8\FCD) - but try on the 'live' version first.
<clock max_speed="16000000"
master_divider="1"
default="8000000" />
Note if you use notepad to edit it likes to save with a .txt extension (which you don't want)
Martin
-
- Valued Contributor
- Posts: 774
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 185 times
- Been thanked: 204 times
Re: Change clock frequency in Flowcode to match Arduino hardware
Hi
Just to follow up on Martin's (as always) excellent advice, Notepad++ is a free download and I would strongly recommend you use that to edit the file. Other text editors that are not designed for "code" can often cause no end of frustration.
Regards
Just to follow up on Martin's (as always) excellent advice, Notepad++ is a free download and I would strongly recommend you use that to edit the file. Other text editors that are not designed for "code" can often cause no end of frustration.
Regards
Re: Change clock frequency in Flowcode to match Arduino hardware [Solved]
Hi Martin & chipfryer27, thank you both. That did it!!
I amended the live version in C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\ARD using Notepad++ as recommended. Not only do I now have the 8MHz clock setting available under the General Options tab / Options menu but other variations too. Bonus!
I am still on V8 for now as I have two long term projects nearing completion and would rather not switch to V10 until they are done.
Much appreciated. You have saved me hours, I am sure.
Kind regards
I amended the live version in C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\ARD using Notepad++ as recommended. Not only do I now have the 8MHz clock setting available under the General Options tab / Options menu but other variations too. Bonus!
I am still on V8 for now as I have two long term projects nearing completion and would rather not switch to V10 until they are done.
Much appreciated. You have saved me hours, I am sure.
Kind regards
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: Change clock frequency in Flowcode to match Arduino hardware [Solved]
Glad to hear it worked okay..
There are many good changes in v10 - so it's maybe worth talking a peek if time allows...
Martin
There are many good changes in v10 - so it's maybe worth talking a peek if time allows...
Martin