Looking for feedback on TIMER changes

Questions about the BASICtools and MakeItC
Post Reply
basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Looking for feedback on TIMER changes

Post by basicchip »

We have added SDcard file system support to BASIC, but have not released that into the SuperPRO. The reason being that it would also include the new way the TIMER function is handled.

Originally TIMER was done with one of the hardware timers. But not all NXP chips have those anymore, and we are now also supporting the Teensy http://www.coridium.us/teensy.php. So we switched to using the Systick Timer. The first pass we try to emulate the original TIMER and have a 32 bit value. To do this we count the Systick up to 65ms and then generate an interrupt and increment a high order count. We combine those 2 values to generate the 32 bit TIMER value that increments every microsecond.

In addition we added a WAITMICRO keyword to time microsecond level times, there is still a WAIT which times in msec.

But we do introduce this Systick interrupt. We could eliminate that if we restrict the TIMER to 24 bit values, but your BASIC code would have to handle the 24 bit rollover. So it might break some existing code, which you would have to change to use WAITMICRO. On the plus side we free up the timer0 hardware in the SUperPRO/PROplus.

How do you all feel about it?



AMDlloydsp
Posts: 99
Joined: Mon Apr 15, 2013 3:51 pm
Location: NE Central FL

Re: Looking for feedback on TIMER changes

Post by AMDlloydsp »

Sorry to be so late in checking back.

Bruce, I wrote a substantial body of code for a 4-axis motion controller that uses Systick interrupts as the method of updating positions and issuing new step pulses to move.

As far as I can tell, it would take only a minor bit of work to alter the interrupt service routines to use TIMERx instead of Systick to do the same thing. It's all in the LPC17xx manual, so...

So, I guess I'm just slightly disappointed that I'd have to rework that code to use the new firmware, but I don't see that as any major problem.


Lloyd

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: Looking for feedback on TIMER changes

Post by basicchip »

This is why we haven't yet released newer SuperPRO code. And I'm not sure we want to support 2 versions out there. The next version would add SDcard file services, SORT, WAITMICRO.

Anything new however, we will be grabbing the Systick for our use.

We are going to be releasing an LPC4330 based board in the Arduino Shield compatible group that will have an SDcard on it.

We could also do a SuperDuperPRO which would use an LPC4078, which runs at 120 MHz, has a floating point processor on it, and on that one we could support the new firmware features, and then just freeze the SuperPRO at the current version.

AMDlloydsp
Posts: 99
Joined: Mon Apr 15, 2013 3:51 pm
Location: NE Central FL

Re: Looking for feedback on TIMER changes

Post by AMDlloydsp »

We could also do a SuperDuperPRO which would use an LPC4078, which runs at 120 MHz, has a floating point processor on it, and on that one we could support the new firmware features, and then just freeze the SuperPRO at the current version.
-------------
Yay! And +1!

The SuperPro works just great. Having hardware floating-point support would be nice, so long as it's fully integrated into BASIC. Although I work in C++ also, I find the BASIC is so powerful that I use it more; mostly because it's so self-documenting and supportable by others. My goal is to always turn my products over to the customer for 'final support', rather than having to chase them for the rest of my 'retirement' years.

Most anyone who knows C, C++, C# also knows BASIC. Not everyone who knows BASIC knows the others. Not even today. <G>

Lloyd

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: Looking for feedback on TIMER changes

Post by olzeke51 »

Well, my ACMP06.bas reads and prints the SYS Tick [as far as I can tell] rapidly 3 times
and it shows it as a down counter ??!!!!

the issue is it looks like a down counter in the LPC812 eval chip
Attachments
ACMP06.bas
(768 Bytes) Downloaded 378 times

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: Looking for feedback on TIMER changes

Post by basicchip »

Systick is the same for all Cortex parts, that is why we switched to use it for TIMER.

And the way we use it is to count down to &H10000 * MHz where MHz is the CPU clock speed, and generate an interrupt every 65 msec, which increments a count

The SYSTICK value and the count_65 are combined to form a 32 bit microsecond counter.

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: Looking for feedback on TIMER changes

Post by olzeke51 »

SO, there is more than one way to skin a cat !!!!
*
deleted reply as it was a rambling - olzeke51
*

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: Looking for feedback on TIMER changes

Post by olzeke51 »

BASICboard -kernel 8.33a -- ARMbasic[9.33a] on the PC
keyword WAITMICRO is giving me errors.
in one program (sounds.bas) I get this : [I put in the @8000 debug info]
Executing...
'
begin
220
4545
2272
Fault at &H801c // NOTE - this is reserved memory for the LPC1114 per the UM
'
Welcome to ARMbasic Kernel[8.33a] ...... for the BASICchip

@8000

00008000: 10000FE0 000000C9 000000C5 000000C5 000000C5 000000C5 000000C5 EFFFEB7E
***********************
in a second program I did WAIT(1) or WAITMICRO(100) --
the WAITMICRO just displays "Executing" in the terminal window
Attachments
wiggle.bas
waitmicro error
(540 Bytes) Downloaded 406 times
sounds.bas
waitmicro error
(734 Bytes) Downloaded 390 times

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: Looking for feedback on TIMER changes

Post by basicchip »

looking, pretty strange as WAITMICRO works in some contexts and the code is almost identical to WAIT

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: Looking for feedback on TIMER changes

Post by basicchip »

Compiler was trying to support the obsolete DATA statement and that broke the new WAITMICRO, so I've given up on DATA statements for now. The const arrays are much better and compatible with VBASIC syntax

http://www.coridiumcorp.com/forum/viewt ... ?f=9&t=637

Post Reply