I've bought a sparkfun logomatic v1.0 to change reprogram as an advanced datalogger. There is a lpc2138 onboard and it is possible to program it with the lpc2000 flash utility.
I've tried to compile a test progam, just to blink some leds on P0.x but the processor seems to do only the first command. I believe there is somewhere a parameter in the compiler settings I've mist.
I set up for a lpc2138 changed the freq to 147.456 MHz, IROM from 0x4 to 0x7FFF, IRAM from 0x40004000 to 0x40007FFF just like detailed in the datasheet.
#include <LPC213x.H> void delayms(int j) { unsigned int i; unsigned int k; i = 0; k = 0; while (i != j) { k = 0; while (k != 14746) { k++; } i++; } } int main (void) { PINSEL0 = 0x00000000; IODIR0 = 0xFFFFFFFF; IOCLR0 = 0xFFFFFFFF; while (1) { IOSET0 = 0xFFFFFFFF; delayms(1000000000); IOCLR0 = 0xFFFFFFFF; delayms(1000000000); } };
Is there anything I'm missing? Thanks in advance, Ruben
If delayms() really gives a one-ms delay, then you are requesting a one-million-seconds long delay. That is almost 278 hours...
By the way, don't do busy-loops for delays. Initialize a timer and use instead.
147.456MHz - is that PLL frequency or the actual instruction frequency? Isn't 60MHz the highest allowed instruction speed for a 2138?
Especially not delays of many(!) hours!
:-0
I don't do that for normal, only for testing if this thing is working, and this stupid thing isn't.
It is a simple procedure I copied from another sample thing.
Greetings, Ruben
But have you verified that the processor frequency is within valid range - you claim 147MHz which is faster than the processor supports, unless you mean PLL.
Also, have you verified that your delay isn't so long that you don't see a blink?
Exactly what have you done to narrow your problem down?
It was indeed a problem of the frequency, I putted in 147 MHz, it was 14 MHz in reallity.
Now, I have only a problem that the arm does only a few times the while(1) cycle.
Thanks for the answers. Ruben
View all questions in Keil forum