I am new to ARM and I am trying to produce 1 second delay using timer 0 in LPC2148. But in debug session in Keil, it is giving delay of 4 seconds with 15MHz and 5 seconds with 12 MHz. What is the issue ?
Here is my code.
#include <lpc214x.h> int main() { IODIR0 = 1; // P0.0 is output pin IOSET0 = 1; // P0.0 is high T0PR = 15000000 - 1; T0TC = T0PC = 0; T0TCR = 1; // start do { while(T0TC == 0); T0TC = 0; IOCLR0 = 1; // P0.0 is low while(T0TC == 0); T0TC = 0; IOSET0 = 1; // P0.0 is high } while(1); }
Ok, so you've got the timer working and the pin to toggle. Why it is not quite at the frequency you want is another matter, but it appears to track your master clock input, so clearly some ratio involved. Not a part I'm using, not super invested in root-causing it.
Suggest perhaps that you write some simple register decoder functions, so say you can pull the PLL or CLOCK registers and decode them into a human readable form. Perhaps read the multiple timer registers and decode their content.
Do other tests, experiment with other peripherals, but be aware that anything outside the core may be poorly emulated.
Do things related to the ARM7 core rather than the NXP implementation around it. Perhaps code some assembler routines, convert decimals to/from binary and ASCII.
Westonsupermare Pier said:Do things related to the ARM7 core rather than the NXP implementation around it
Do you mean I should not use LPC2148 ? If this then which one I should use ?
Westonsupermare Pier said:Do other tests, experiment with other peripherals
definitely. I am trying to get the value by experimenting with multiple values of VPBDIV
Andy Neil said:All the more reason to start with something up-to-date
And now I am thinking to invest some in latest low cost ARM microcontroller
kamalpancholi said:Westonsupermare Pier said:Do things related to the ARM7 core rather than the NXP implementation around it Do you mean I should not use LPC2148 ? If this then which one I should use ?
You need to understand that ARM do not make any microcontrollers at all.
ARM simply license the designs of CPU cores to chipmakers.
The chipmakers incorporate ARM's CPU design into their microcontrollers, along with other components of their own, proprietary, design - such as Timers, IO, etc.
So what Westonsupermare Pier is saying is for you to concentrate on stuff which relates the the ARM CPU Core - rather than stuff which is proprietary to a particular manufacturer (eg, NXP) and/or peculiar to a particular chip (eg, LPC2148).
EDIT
This diagram (actually from an Analog Devices part) clearly shows which part is the ARM core - the rest is the manufacturer's own IP:
Another post explaining "ARM don't make chips":
https://community.arm.com/developer/ip-products/system/f/embedded-forum/3068/how-can-i-learn-to-build-my-own-computer-with-arm-processors/22472#22472
Andy Neil said:ARM simply license the designs of CPU cores to chipmakers
These designs are commonly known as "Intellectual Property" - or "IP" for short.(not to be confused with "IP" for "Internet Protocol").
https://en.wikipedia.org/wiki/Arm_Holdings#Business_model
ARM do also license other types of IP besides just the CPU cores.
Andy Neil said:The chipmakers incorporate ARM's CPU design into their microcontrollers, along with other components of their own, proprietary, design - such as Timers, IO, etc
These other designs are also commonly referred to as "IP".
This is the IP which distinguishes one manufacturer's ARM-based microcontroller from another manufacturer's microcontroller based on the same ARM core.
You will often find that manufacturers re-use such IP across multiple products.
This photo is not so clearly, could it be patched more detail described? I also wonder there is how many instructions in M series ARM core.
Jackzhu said:This photo is not so clearly
You mean this one:
I think you're missing the point.
The point - which is clear to see in that image - is that the actual ARM part is just a small part within the whole chip. All the rest around it is not ARM - it is the chipmaker's proprietary stuff.
Andy Neil said:from an Analog Devices part
If you actually want to find out more about that particular Analog Devices chip (and find the original diagram), go to:
https://www.analog.com/en/products/landing-pages/001/adsp-cm40x-product-family.html
Jackzhu said: I also wonder there is how many instructions in M series ARM core.
That has nothing to do with this thread!
If you want to start a separate discussion on that, start a new thread in the Cortex-M forum:
https://community.arm.com/developer/ip-products/processors/f/cortex-m-forum
But the Instruction Set is well documented - be sure to Please read the manual first!