Flowcode V7 with ARM AT91SAM7s64-64 for LED blank

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
damstech8888
Posts: 14
Joined: Wed Mar 05, 2014 11:43 am
Has thanked: 1 time

Flowcode V7 with ARM AT91SAM7s64-64 for LED blank

Post by damstech8888 »

Dear Benj,

I am using ARM with FLOWCODE V6 for my first ARM study. I found that I can't even get LED blank right with Flowcode V6 or V7.

I am using simple AT91SAM7S64 board like this: Image With USB SAM-BA V2.16.

First of all, I fallow this post "viewtopic.php?f=54&t=14469" to modify

CODE (rx) : ORIGIN = 0x00100000, LENGTH = 0x0000E000

And change "general options / clock speed (Hz): 32000 " to meet RESET internal clock 32KHz ( correct me if I am wrong)

To get my program work, and YES, LED blank now but clock is not correct. It seems double times quicker.

I don't understand why due to can't found any clock description in Flowcode ARM.

I found there are some code in my C after Flowcode assembly. :
------------------------------------------------------
#define MX_CLK_SPEED 32000

#define FCP_NULL Unconnected_Port

#define MCK MX_CLK_SPEED
#define MCKKHz (MCK/1000)
#define MCKMHz ((MCKKHz+500)/1000)
-----------------------------------------------------

Why is the KHz is div by 1000 but MHz add 500 then div by 1000?
Sorry I don't understand C, I am new in ARM and can't find ways to correct my LED blank correctly in V6 or V7.
Please Adv. Thank you.
Attachments
Flowcode1.fcfx
LED blank in 1 sec delay
(4.51 KiB) Downloaded 247 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: Flowcode V7 with ARM AT91SAM7s64-64 for LED blank

Post by Benj »

Hello,

If your delays are 2x shorter then they should be then it sounds like your clock speed is 2x faster then you think it is. Try entering 64000 in the clock speed setting in the project options and hopefully that should fix the problem for you.
Why is the KHz is div by 1000 but MHz add 500 then div by 1000?
Adding 500 or in some cases 0.5 is a means to get a more reliable result by rounding up. We do the same thing for working out fast baud data rates on slower devices and the round up gives a better approximation and hence a more acceptable baud rate.

Post Reply