Page 1 of 1

Flowcode V7 with ARM AT91SAM7s64-64 for LED blank

Posted: Tue Mar 14, 2017 5:19 am
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.

Re: Flowcode V7 with ARM AT91SAM7s64-64 for LED blank

Posted: Tue Mar 14, 2017 10:58 am
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.