Embedded System help (C language, Keil MCB2300 board)

Soldato
Joined
25 Dec 2002
Posts
2,862
Right, i'm doing some programming at present in C on a Keil MCB2300 baord (based on ARM processor).

I'm trying ot make a stopwatch that uses the inbuilt hardware timer, now it works...but it doesn't count up correctly.

Does anyone have any experience with these systems, as I don't want to post up pages of code unless someone has experiance with the system.

Cheers :)
 
I've not used that particular type of board although I've programmed ARM assembler as well as C/Assembler on the Blackfin 537 at an embedded level.

If it's not counting up correctly then it sounds like you're missing the timer periods. How you're missing depends on if you're using polled or interrupt driven coding.

Interrupts - you could be taking too long in servicing the interrupt. Have you tried limiting the servicing to just incrementing a memory location then clearing the interrupt flag before returning to normal?
I see the 2300 is an ARM7 which I assume is in tumb mode. Probably slightly different to the 710 I programmed in 32bit.

Polling - you'll need to poll very regularly unless you can cope with missed timer pulses, especially if another interrupt is taking time.
 
It's a 32 bit timer, operating at 12Mhz. The way it operates on the board is you can set an upper limit on the timer, once this limit is reached it increments a timer overflow register by 1, this is what triggers an interrupt to increment a variable (milliseconds)

The timer limit is set to 11999 to represent 1 ms, as 12000 / 12000000 = 0.001 seconds, or 1 ms.
 
ok, so you say the timer is not counting correctly, what frequency is it actually generating an interrupt?

Check for any pre- or post- scalers applied to the timer function, and check that the timer is actually using the CPU frequency (12MHz) as its input, and not a divisor of that
 
Found out the problem, the uVision software we are using wasn't correctly configured for the boards and as such was setup to use different timer frequencies!
 
Back
Top Bottom