Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ARM7 (LCP21xx, 23xx, 24xx) & cortexM (LPC17xx,13xx,11xx) register settings wizard

Status
Not open for further replies.

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,888
Helped
2,021
Reputation
4,158
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,371
Hi
I have used AVR's for a few years and I'm trying to learn how to use ARM7 and specifically the NXP/Philips LPC2103 and maybe LPC2131.
I was wondering if anyone knows of an application that includes a wizard (like the codevisionAVR) where you can select the function of the pins , inputs/outputs , enable and setup timers, ADC etc. and automatically create an initialization file with the registers setup values for the selected functions.
I' don't mean the start up file which is made automatically with applications like Keil uvision because this file has a different purpose.
I wasn't able to find such an application and it would make life much easier.

Alex
 

Re: ARM7 (LCP21XX) register settings wizard?

Only pdf can help. ya i also felt that the same way after running with ARM from 10years. wish i had a tool. there is no help other than pdf register information
 

Re: ARM7 (LCP21XX) register settings wizard?

I wasn't able to find any software that can help with the configuration of resisters so i have started my own freeware application.
This is the first version of the software, it can help to set up the mcu pin registers that control the function of the pin and I/O direction.
I will add more features and I will post them here as I do,
my intension is to add timers, interrupt, ADC, SPI.

The current version Supports the following mcu but i will also add some more later.
LPC2101-02-03
LPC2131-32-34-36-38

Here is the download link
**broken link removed**

And a screenshot of the program
**broken link removed**

and a sample of the generated code

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// P0.0:  TXD0 (Transmitter output for UART0)
 // P0.1:  RxD0 (Receiver input for UART0)
 // P0.2:  PORT0.2 (General purpose I/O)  Output
 // P0.3:  PORT0.3 (General purpose I/open-drain O)  Output
 // P0.4:  PORT0.4 (General purpose I/open-drain O)  Output
 // P0.5:  PORT0.5 (General purpose I/O)  Output
 // P0.6:  AD1.0 (A/D converter 1 input 0)
 // P0.7:  EINT2 (External interrupt 2 input)
 // P0.8:  PORT0.8 (General purpose I/O)  Input
 // P0.9:  PORT0.9 (General purpose I/O)  Input
 // P0.10:  PORT0.10 (General purpose I/O)  Input
 // P0.11:  PORT0.11 (General purpose I/O)  Input
 // P0.12:  PORT0.12 (General purpose I/O)  Input
 // P0.13:  PORT0.13 (General purpose I/O)  Input
 // P0.14:  PORT0.14 (General purpose I/O)  Input
 // P0.15:  PORT0.15 (General purpose I/O)  Input
 // P0.16:  PORT0.16 (General purpose I/O)  Input
 // P0.17:  PORT0.17 (General purpose I/O)  Input
 // P0.18:  PORT0.18 (General purpose I/O)  Input
 // P0.19:  PORT0.19 (General purpose I/O)  Input
 // P0.20:  PORT0.20 (General purpose I/O)  Input
 // P0.21:  PORT0.21 (General purpose I/O)  Input
 // P0.22:  PORT0.22 (General purpose I/O)  Input
 // P0.23:  PORT0.23 (General purpose I/O)  Input
 // P0.25:  PORT0.25 (General purpose I/O)  Input
 // P0.26:  PORT0.26 (General purpose I/O)  Input
 // P0.27:  PORT0.27 (General purpose I/O)  Input
 // P0.28:  PORT0.28 (General purpose I/O)  Input
 // P0.29:  PORT0.29 (General purpose I/O)  Input
 // P0.30:  PORT0.30 (General purpose I/O)  Input
 // P0.31:  PORT0.31 (General purpose O)  Output
 // P1.16:  PORT1.16 (General purpose I/O)  Input
 // P1.17:  PORT1.17 (General purpose I/O)  Input
 // P1.18:  PORT1.18 (General purpose I/O)  Input
 // P1.19:  PORT1.19 (General purpose I/O)  Input
 // P1.20:  PORT1.20 (General purpose I/O)  Input
 // P1.21:  PORT1.21 (General purpose I/O)  Input
 // P1.22:  PORT1.22 (General purpose I/O)  Input
 // P1.23:  PORT1.23 (General purpose I/O)  Input
 // P1.24:  PORT1.24 (General purpose I/O)  Input
 // P1.25:  POR11.25 (General purpose I/O)  Input
 // P1.26:  PORT1.26 (General purpose I/O)  Input
 // P1.27:  PORT1.27 (General purpose I/O)  Input
 // P1.28:  PORT1.28 (General purpose I/O)  Input
 // P1.29:  PORT1.29 (General purpose I/O)  Input
 // P1.30:  PORT1.30 (General purpose I/O)  Input
 // P1.31:  PORT1.31 (General purpose I/O)  Input
PINSEL0=0x0000F005;  // 0b00000000000000001111000000000101
IO0DIR=0x8000003C;  // 0b10000000000000000000000000111100
PINSEL1=0x00000000;  // 0b00000000000000000000000000000000
PINSEL2=0x00000000;  // 0b00000000000000000000000000000000
IO1DIR=0x00000000;  // 0b00000000000000000000000000000000



I have also created a web page for the software, you can find my home page through my profile, but i will also post the latest version here too.

Alex

P.S. this is a windows application but all the library needed are included in the executable so it may work using WINE in linux but i haven't tried.
 
Last edited:
Re: ARM7 (LCP21XX) register settings wizard? (ARMwizard v1.1)

I have updated my application to v1.1,
in this version i have added a screen where all the available interrupt
sources are listed , from there you can select the needed interrupts and place them
in the selected interrupt vectors.

The code generated includes the main function, the interrupt functions and
the initialization of them and of course the settings for registers that control
the function of the pins and I/O direction like the previous version.

LINUX USERS
I have tested the application in PC-Linux using WINE, unfortunately there is a
problem in the I/O page and the mouse position is not detected properly.
The only workaround for now if to use the arrow keys to navigate and
space to select/change, also the + and - expand/collapse the tree nodes.

The supported mcu list is the same as the previous version
LPC2101-02-03
LPC2131-32-34-36-38

You can download from **broken link removed**

This is a sample of the interrupt screen
**broken link removed**

And a sample of the generated code

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#include <LPC213x.h>
 
 
/******************************************************************************
                  EINT0 FAST interrupt service function
******************************************************************************/
__irq void FIQ_Handler (void) {
// write code here
 
 
EXTINT |= 1;   // Clear EINT0 interrupt flag 
VICVectAddr = 0;   /* Acknowledge Interrupt       */
}
 
  APPLY THE FOLLOWING SO THAT FIQ WORKS PROPERLY
/**********************************************************************************************************
  COMMENT THIS LINE IN THE STARTUP FILE USING A SEMICOLON ";" ---> ";FIQ_Handler     B       FIQ_Handler" 
 
  ADD THE FOLLOWING LINE IN THE STARTUP CODE DIRECTLY ABOVE THE "Reset_Addr      DCD     Reset_Handler"
 
       IMPORT FIQ_Handler    ;<---- add this line and use space in front of it
**********************************************************************************************************/
 
/******************************************************************************
                  EINT1 interrupt service function
******************************************************************************/
__irq void EINT1_int (void) {
// write code here
 
 
EXTINT |= 2;   // Clear EINT1 interrupt flag 
VICVectAddr = 0;   /* Acknowledge Interrupt       */
}
 
/******************************************************************************
                  EINT2 interrupt service function
******************************************************************************/
__irq void EINT2_int (void) {
// write code here
 
 
EXTINT |= 4;   // Clear EINT2 interrupt flag 
VICVectAddr = 0;   /* Acknowledge Interrupt       */
}
 
/******************************************************************************
                  WDT interrupt service function
******************************************************************************/
__irq void WDT_int (void) {
// write code here
 
 
VICVectAddr = 0;   /* Acknowledge Interrupt       */
}
 
/******************************************************************************
                  EINT3 interrupt service function
******************************************************************************/
__irq void EINT3_int (void) {
// write code here
 
 
EXTINT |= 8;   // Clear EINT3 interrupt flag 
VICVectAddr = 0;   /* Acknowledge Interrupt       */
}
 
/******************************************************************************
                  UART0 interrupt service function
******************************************************************************/
__irq void UART0_int (void) {
// write code here
 
 
VICVectAddr = 0;   /* Acknowledge Interrupt       */
}
 
/* Default Interrupt Function: may be called when ISR is disabled */
__irq void DefISR (void) {
}
 
int main(void)
{
 // P0.0:  TXD0 (Transmitter output for UART0)
 // P0.1:  RxD0 (Receiver input for UART0)
   // P0.2:  PORT0.2 (General purpose I/O)  Input
   // P0.3:  PORT0.3 (General purpose I/open-drain O)  Input
   // P0.4:  PORT0.4 (General purpose I/open-drain O)  Output
   // P0.5:  PORT0.5 (General purpose I/O)  Input
   // P0.6:  PORT0.6 (General purpose I/O)  Output
   // P0.7:  PORT0.7 (General purpose I/O)  Output
   // P0.8:  PORT0.8 (General purpose I/O)  Input
 // P0.9:  EINT3 (External interrupt 3 input)
   // P0.10:  PORT0.10 (General purpose I/O)  Input
   // P0.11:  PORT0.11 (General purpose I/O)  Input
   // P0.12:  PORT0.12 (General purpose I/O)  Output
   // P0.13:  PORT0.13 (General purpose I/O)  Input
 // P0.14:  EINT1 (External interrupt 1 input)
 // P0.15:  EINT2 (External interrupt 2 input)
   // P0.16:  PORT0.16 (General purpose I/O)  Input
   // P0.17:  PORT0.17 (General purpose I/O)  Input
   // P0.18:  PORT0.18 (General purpose I/O)  Input
   // P0.19:  PORT0.19 (General purpose I/O)  Input
   // P0.20:  PORT0.20 (General purpose I/O)  Input
   // P0.21:  PORT0.21 (General purpose I/O)  Input
   // P0.22:  PORT0.22 (General purpose I/O)  Input
   // P0.23:  PORT0.23 (General purpose I/O)  Input
   // P0.25:  PORT0.25 (General purpose I/O)  Input
   // P0.26:  PORT0.26 (General purpose I/O)  Input
   // P0.27:  PORT0.27 (General purpose I/O)  Input
   // P0.28:  PORT0.28 (General purpose I/O)  Input
   // P0.29:  PORT0.29 (General purpose I/O)  Input
   // P0.30:  PORT0.30 (General purpose I/O)  Input
   // P0.31:  PORT0.31 (General purpose O)  Output
   // P1.16:  PORT1.16 (General purpose I/O)  Input
   // P1.17:  PORT1.17 (General purpose I/O)  Input
   // P1.18:  PORT1.18 (General purpose I/O)  Input
   // P1.19:  PORT1.19 (General purpose I/O)  Input
   // P1.20:  PORT1.20 (General purpose I/O)  Input
   // P1.21:  PORT1.21 (General purpose I/O)  Input
   // P1.22:  PORT1.22 (General purpose I/O)  Input
   // P1.23:  PORT1.23 (General purpose I/O)  Input
   // P1.24:  PORT1.24 (General purpose I/O)  Input
   // P1.25:  POR11.25 (General purpose I/O)  Input
   // P1.26:  PORT1.26 (General purpose I/O)  Input
   // P1.27:  PORT1.27 (General purpose I/O)  Input
   // P1.28:  PORT1.28 (General purpose I/O)  Input
   // P1.29:  PORT1.29 (General purpose I/O)  Input
   // P1.30:  PORT1.30 (General purpose I/O)  Input
   // P1.31:  PORT1.31 (General purpose I/O)  Input
 
   PINSEL0=0xA00C0005;     // binary: 10100000_00001100_00000000_00000101
   IO0DIR=0x800010D0;     // binary: 10000000_00000000_00010000_11010000
   PINSEL1=0x00000000;     // binary: 00000000_00000000_00000000_00000000
   PINSEL2=0x00000000;     // binary: 00000000_00000000_00000000_00000000
   IO1DIR=0x00000000;     // binary: 00000000_00000000_00000000_00000000
 
   VICIntSelect |= (1<<14);           /* Set EINT0 as FAST Interrupt */
   VICIntEnable |= (1<<14);           /* Enable EINT0 FAST Interrupt */
 
   VICVectAddr0 = (unsigned long) EINT1_int;           /* set interrupt vector 0 */
   VICVectCntl0 = ( 0x20 | 15 );           /* enable slot & use it for EINT1 Interrupt */
   VICIntEnable |= (1<<15);           /* Enable EINT1 Interrupt */
 
   VICVectAddr1 = (unsigned long) EINT2_int;           /* set interrupt vector 1 */
   VICVectCntl1 = ( 0x20 | 16 );           /* enable slot & use it for EINT2 Interrupt */
   VICIntEnable |= (1<<16);           /* Enable EINT2 Interrupt */
 
   VICVectAddr2 = (unsigned long) WDT_int;           /* set interrupt vector 2 */
   VICVectCntl2 = ( 0x20 | 0 );           /* enable slot & use it for WDT Interrupt */
   VICIntEnable |= (1<<0);           /* Enable WDT Interrupt */
 
   VICVectAddr3 = (unsigned long) EINT3_int;           /* set interrupt vector 3 */
   VICVectCntl3 = ( 0x20 | 17 );           /* enable slot & use it for EINT3 Interrupt */
   VICIntEnable |= (1<<17);           /* Enable EINT3 Interrupt */
 
   VICVectAddr4 = (unsigned long) UART0_int;           /* set interrupt vector 4 */
   VICVectCntl4 = ( 0x20 | 6 );           /* enable slot & use it for UART0 Interrupt */
   VICIntEnable |= (1<<6);           /* Enable UART0 Interrupt */
 
   VICDefVectAddr = (unsigned long) DefISR;     /* un-assigned VIC interrupts */
 
   while(1)
  {
  
  
   }
 
}



Alex
 

Re: ARM7 (LCP21XX) register settings wizard?

I have just uploaded the new version (v1.1.1) to my page ,
it is a minor update in the functionality of the application but i have also added the following devices
LPC2104-05-06
LPC2141-42-44-46-48

This included mcu should cover now the most popular models in the 21xx series i think.

Download link
**broken link removed**

or visit my home page through my profile.

Alex
 
Re: ARM7 (LCP21XX) register settings wizard?

I have released version 1.2

Visit my website through my profile (i have also added RSS to my page),
or download directly using this **broken link removed**

what is new in ARMwizard v1.2
---------------------------------------------
A/D converter settings added
clear flag code in interrupts corrected from (x|=value) to (x=value) [Nathan Boyd LPC2000 yahoogroup]
USB interrupt clear reg name corrected for LPC2141/2/4/6/8.
SPI1/SSP interrupt function name has been corrected

**broken link removed**

In addition to the code as the previous post this version adds the ADC initialization code, this is a sample


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/******************************************************************************
                                ADC0
*******************************************************************************
   ADC operational
   ADC clk: 2500000 Hz
   ADC rate: 227272,7 samples/sec
   manual mode, 11 clocks / 10 bit accuracy
   Start conversion now.
   Channel 0 dissabled, no interrupt
   Channel 1 enabled, will generate an interrupt when conversion ends
   Channel 2 dissabled, no interrupt
   Channel 3 dissabled, no interrupt
   Channel 4 dissabled, no interrupt
   Channel 5 dissabled, no interrupt
   Channel 6 dissabled, no interrupt
   Channel 7 dissabled, no interrupt
*/
 
AD0CR=0x01200502;     /* binary: 00000001_00100000_00000101_00000010 */
AD0INTEN=0x00000002;     /* binary: 00000000_00000000_00000000_00000010 */



Alex
 
Re: ARM7 (LCP21XX) register settings wizard?

I have released version 1.2.1 of my freeware application

The application has settings for the A/D converter,can initialize the direction and
functionality of pin registers and also setup the interrupt sources and adds automatically
the interrupt functions and initialization code.
You can view a sample of the generated code in previous posts

Supports
LPC2101-02-03
LPC2104-05-06
LPC2131-32-34-36-38
LPC2141-42-44-46-48

Visit my website through my profile (i have also added RSS to my page),
or download directly using this **broken link removed**

What is new in ARMwizard v1.2.1
-------------------------------------------------
  • the application is now fully compatible with Linux using WINE
  • a fast selector menu has been added which serves a dual purpose
    - shows which alternative pin functions are enabled
    - goes directly to the pin with the selected function when clicked
  • added pin diagram pictures for all included ARM mcu [ajishgopalr edaboard.com]
  • some small fixes of function descriptions for the mcu pins
  • FIO checkbox, when checked the generated code uses Fast GPIO registers and adds the initialization

**broken link removed**

Best regards
Alex
 
Re: ARM7 (LCP21XX) register settings wizard?

I have uploded ARMwizard v1.3 to my website.

what is new in v1.3
  • Added external interrupt settings in the interrupt tab, these are automatically enabled when an external interrupt is added to a vector
  • Added timers tab for up to four 16/32bit timer settings, all the settings are available using check boxes, dropdown and edit boxes.
  • All the mcu pin diagrams pictures have been resized to have a height of 650 pixels because in the previous version some of them had a height of more than 768 pixels [ajishgopalr edaboard.com]
  • The first mcu profile is now automatically selected in the combobox (not loaded)
  • The frequency is automatically converted to MHz/KHz/Hz and period in ns/us/ms/s for easier read

The settings included in this version are
  • GPIO, select inputs/output direction or any alternative pin function using a convenient graphic interface and also a quick selector which has all the functions in groups.
  • Interrupts, select from a list any of the available interrupts sources and add them to the selected vector, the functions will be created automatically.
  • External Interrupts, set the external interrupt options using combo boxes.
  • A/D converter, set any aspect of the ADC (mode, channels, interrupts etc.) with explanation for every setting and see the calculated clock and sample rate without having to calculate anything.
  • Timers, set any aspect of 16/32 bit timers (mode, MAT, CAP, interrupts etc.) with explanation for every setting and automatic clock calculation.

These are images from the added settings

**broken link removed**
**broken link removed**

And this is a sample code for the added timers and external interrupt code

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/******************************************************************************
                           External interrupts
*******************************************************************************
    Ext. interrupt 0 mode: Level sensitivity / Active low  / wake on interrupt 0 is Off
    Ext. interrupt 2 mode: Edge sensitivity / Rising edge  / wake on interrupt 2 is Off
*/
    EXTMODE=0x04;     /* binary: 00000100 */
    EXTPOLAR=0x04;     /* binary: 00000100 */
    INTWAKE=0x0000;     /* binary: 00000000_00000000 */
    EXTINT=0x05;     /* clear all the external interrupt flags */
 
/******************************************************************************
                           Timer0 (32bit)
*******************************************************************************
   Counter Enabled,    Counter Reset=0
   Timer mode: count on rising edge of PCLK
   Counter clk: 15 MHz, Counts every: 66,67 ns  (calculated with peripheral clock:15MHz)
   MCR0.1 : reset, stop, generate interrupt on complare match
   MCR0.3 : reset, on complare match
   CCR0.0 : capture on rising edge, capture on falling edge, 
   CCR0.2 : capture on rising edge, capture on falling edge, generate interrupt on capture event, 
   MAT0.0 : On compare match Set bit/output
*/
T0TCR=0x01;     /* binary: 00000001 */
T0CTCR=0x00;     /* binary: 00000000 */
T0TC=0x00000000;     /* decimal 0 */
T0PR=0x00000000;     /* decimal 0 */
T0PC=0x00000000;     /* decimal 0 */
T0MCR=0x0438;     /* binary: 00000100_00111000 */
T0MR0=0x00000000;     /* decimal 0 */
T0MR1=0x00000208;     /* decimal 520 */
T0MR2=0x00000000;     /* decimal 0 */
T0MR3=0x000000C8;     /* decimal 200 */
T0CCR=0x01C3;     /* binary: 00000001_11000011 */
T0EMR=0x0021;     /* binary: 00000000_00100001 */
PWM0CON=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
 
/******************************************************************************
                           Timer1 (32bit)
*******************************************************************************
   Counter Enabled,    Counter Reset=0
   Timer mode: count on rising edge of PCLK
   Counter clk: 576,9231 KHz, Counts every: 1,73 us  (calculated with peripheral clock:15MHz)
   MCR1.1 : reset, generate interrupt on complare match
   CCR1.2 : capture on falling edge, generate interrupt on capture event, 
   CCR1.3 : capture on rising edge, capture on falling edge, 
*/
T1TCR=0x01;     /* binary: 00000001 */
T1CTCR=0x00;     /* binary: 00000000 */
T1TC=0x00000000;     /* decimal 0 */
T1PR=0x00000019;     /* decimal 25 */
T1PC=0x00000000;     /* decimal 0 */
T1MCR=0x0018;     /* binary: 00000000_00011000 */
T1MR0=0x00000064;     /* decimal 100 */
T1MR1=0x000000C8;     /* decimal 200 */
T1MR2=0x00000000;     /* decimal 0 */
T1MR3=0x00000000;     /* decimal 0 */
T1CCR=0x0780;     /* binary: 00000111_10000000 */
T1EMR=0x0000;     /* binary: 00000000_00000000 */
PWM1CON=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */



Visit my website through my profile,
or download directly using this **broken link removed**

Best regards
Alex
 
Re: ARM7 (LCP21XX) register settings wizard?

Great work alex.... It will be useful for many people who are switching over from AVR to LPC series...
 
  • Like
Reactions: Kvel

    Kvel

    Points: 2
    Helpful Answer Positive Rating
ARMwizard v1.3.1 update

Hi

I have updated the application to version 1.3.1

What is new
-Added LPC2420, LPC2458, LPC2460/68, LPC2470/78
-Added save/load to store/restore configuration (I/O, interrupts, ADC, Timers etc.)
-The reserved alt. pin function radio buttons in treeview are now grayed and not selectable.
-Added Pull up/down resistor setting for LPC23xx/24xx
-The peripheral clock dividers can be different for each peripheral for 23xx/24xx support

Visit my website through my profile,
or download directly using this **broken link removed**

Alex
 
Last edited:
Re: ARM7 (LCP21XX) register settings wizard?

ARMwizard updated to version 1.3.2

What is new
-Added the complete LPC23xx series mcu (LPC2361/62/64/65/66/67/68/77/78/87/88)
-The ADC channels that are not available are now disabled (grey checkbox)
-The interrupt initialization for 24xx has been fixed.
-The selected mcu profile is shown with red in the mcu selector
-The fast interrupt is shown with blue color (vectored isr shown in red) in the available interrupt selector

Visit my website through my profile,
or download directly using **broken link removed**

Alex
 
Re: ARM7 (LCP21XX) register settings wizard?

ARMwizard updated to version 1.4

What is new

  • Added the PWM settings tab to set all the registers of pulse width modulation
  • The last loaded configuration file (.sav) is stored and used as default path/name when you restart the application and press load configuration. [Simon B.]
  • The PR register of Timers, MR0 register of PWM and CLKDIV of ADC have a right click function to set value by target frequency or period. [Simon B.]
  • The CCLK clock frequency is always common and can't be set individually for each peripheral.
  • Added individual PCLK setting for each timer for chips that support it (23xx, 24xx).
  • ADGINTEN (in ADC) is now enabled by default since the reset value of the register is 1.
  • The load button is now enabled when the application starts.

**broken link removed**

this is a sample of the generated PWM initialization code

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/******************************************************************************
                            PWM1
*******************************************************************************
   Counter Enabled,    Counter Reset=0,    PWM mode enabled
   Timer mode: count on rising edge of PCLK
   Counter clk: 15 MHz, Counts every: 66,67 ns  (calculated with peripheral clock: 15MHz)
   MCR1.0 : reset, on compare match
   PWM frequency: 50 KHz
   PWM1: Single edge, set by MR0, reset by MR1, output enabled
   PWM2: Single edge, set by MR0, reset by MR2, output disabled
   PWM3: Single edge, set by MR0, reset by MR3, output disabled
   PWM4: Double edge, set by MR3, reset by MR4, output enabled
   PWM5: Single edge, set by MR0, reset by MR5, output disabled
   PWM6: Single edge, set by MR0, reset by MR6, output disabled
*/
PWM1TC=0x00000000;     /* decimal 0 */
PWM1PR=0x00000000;     /* decimal 0 */
PWM1MCR=0x00000002;     /* binary: 00000000_00000000_00000000_00000010 */
PWM1MR0=0x0000012C;     /* decimal 300 */
PWM1MR1=0x00000096;     /* decimal 150 */
PWM1MR2=0x00000000;     /* decimal 0 */
PWM1MR3=0x00000020;     /* decimal 32 */
PWM1MR4=0x00000030;     /* decimal 48 */
PWM1MR5=0x00000000;     /* decimal 0 */
PWM1MR6=0x00000000;     /* decimal 0 */
PWM1CTCR=0x00;     /* binary: 00000000 */
PWM1CCR=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
PWM1PCR=0x00001210;     /* binary: 00000000_00000000_00010010_00010000 */
PWM1TCR=0x09;     /* binary: 00001001 */



Visit my website through my profile,
or download directly using **broken link removed**

Alex
 
  • Like
Reactions: Kvel

    Kvel

    Points: 2
    Helpful Answer Positive Rating
Re: ARM7 (LCP21XX) register settings wizard?

ARMwizard updated to version 2.0
This is the first version that supports the LPC17xx Cortex M3 chips (LPC1763/64/65/66/67/68/69), more 17xx models will be added in newer versions.

What is new

  • Added support for LPC17xx chips, includes LPC1763/64/65/66/67/68/69 mcu profiles
  • Added pin setting for open drain and repeater mode for LPC17xx
  • Added GPIO interrupt trigger edge selector to enable interrupts for selected GPIO pins
  • CLKDIV register of A/D can also be set by target sample rate ( in addition to A/D frequency)
  • When Timer2 & Timer3 is used the PCONP enable bit is set to enable the timer operation

Visit my website through my profile, or download directly using **broken link removed**

Alex

GPIO interrupts
**broken link removed**

ADC/Timer/PWM prescaler setting by target frequency
**broken link removed**

Open drain setting for 17xx
**broken link removed**

Sample code for 17xx

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/************************************************************************************
   Code created using the ARMwizard, visit **broken link removed** 
************************************************************************************/
 
#include <LPC17xx.h>
 
 
/******************************************************************************
                  TIMER0 interrupt service function
******************************************************************************/
__irq void TIMER0_IRQHandler(void) {
/* write code here */
 
 
/* list of all available flags, select which to use */
LPC_TIM0->IR = 1;   /* Clear MAT0.0 interrupt flag */
LPC_TIM0->IR = 2;   /* Clear MAT0.1 interrupt flag */
LPC_TIM0->IR = 4;   /* Clear MAT0.2 interrupt flag */
LPC_TIM0->IR = 8;   /* Clear MAT0.3 interrupt flag */
LPC_TIM0->IR = 16;  /* Clear CAP0.0 interrupt flag */
LPC_TIM0->IR = 32;  /* Clear CAP0.1 interrupt flag */
}
 
/******************************************************************************
                  EINT0 interrupt service function
******************************************************************************/
__irq void EINT0_IRQHandler(void) {
/* write code here */
 
 
LPC_SC->EXTINT = 1;   /* Clear EINT0 interrupt flag */
}
 
/******************************************************************************
                  SPI interrupt service function
******************************************************************************/
__irq void SPI_IRQHandler(void) {
/* write code here */
 
 
LPC_SPI->SPINT = 1;   /* Clear SPI interrupt flag */
}
 
int main(void)
{
/*
    P0.0:  PORT0.0 (General purpose I/O)  Output, pull-up resistor enabled
    P0.1:  PORT0.1 (General purpose I/O)  Output, pull-up resistor enabled
    P0.2:  PORT0.2 (General purpose I/O)  Input, repeater mode
    P0.3:  PORT0.3 (General purpose I/O)  Input, repeater mode, open drain
    P0.4:  PORT0.4 (General purpose I/O)  Input, pull-up resistor enabled
    P0.5:  PORT0.5 (General purpose I/O)  Input, pull-up resistor enabled
    P0.6:  PORT0.6 (General purpose I/O)  Input, neither pull-up nor pull-down
    P0.7:  PORT0.7 (General purpose I/O)  Input, neither pull-up nor pull-down
    P0.8:  PORT0.8 (General purpose I/O)  Input, pull-down resistor enabled, open drain
    P0.9:  PORT0.9 (General purpose I/O)  Input, pull-up resistor enabled
    P0.10:  PORT0.10 (General purpose I/O)  Input, pull-up resistor enabled
    P0.11:  PORT0.11 (General purpose I/O)  Input, pull-up resistor enabled
    P0.15:  PORT0.15 (General purpose I/O)  Input, pull-up resistor enabled
    P0.16:  PORT0.16 (General purpose I/O)  Input, pull-up resistor enabled, open drain
    P0.17:  PORT0.17 (General purpose I/O)  Input, pull-up resistor enabled
    P0.18:  PORT0.18 (General purpose I/O)  Input, pull-up resistor enabled
    P0.19:  PORT0.19 (General purpose I/O)  Input, pull-up resistor enabled
    P0.20:  PORT0.20 (General purpose I/O)  Input, pull-up resistor enabled
    P0.21:  PORT0.21 (General purpose I/O)  Input, pull-up resistor enabled
    P0.22:  PORT0.22 (General purpose I/O)  Input, pull-up resistor enabled
    P0.23:  PORT0.23 (General purpose I/O)  Input, pull-up resistor enabled
    P0.24:  PORT0.24 (General purpose I/O)  Input, pull-up resistor enabled
    P0.25:  PORT0.25 (General purpose I/O)  Input, pull-up resistor enabled
    P0.26:  PORT0.26 (General purpose I/O)  Input, pull-up resistor enabled
    P0.27:  PORT0.27 (General purpose I/open-drain O)  Input
    P0.28:  PORT0.28 (General purpose I/open-drain O)  Input
    P0.29:  PORT0.29 (General purpose I/O)  Input
    P0.30:  PORT0.30 (General purpose I/O)  Input
    P1.0:  PORT1.0 (General purpose I/O)  Input, pull-up resistor enabled
    P1.1:  PORT1.1 (General purpose I/O)  Input, pull-up resistor enabled
    P1.4:  PORT1.4 (General purpose I/O)  Input, pull-up resistor enabled
    P1.8:  PORT1.8 (General purpose I/O)  Input, pull-up resistor enabled
    P1.9:  PORT1.9 (General purpose I/O)  Input, pull-up resistor enabled
    P1.10:  PORT1.10 (General purpose I/O)  Input, pull-up resistor enabled
    P1.14:  PORT1.14 (General purpose I/O)  Input, pull-up resistor enabled
    P1.15:  PORT1.15 (General purpose I/O)  Input, pull-up resistor enabled
    P1.16:  PORT1.16 (General purpose I/O)  Input, pull-up resistor enabled
    P1.17:  PORT1.17 (General purpose I/O)  Input, pull-up resistor enabled
    P1.18:  PORT1.18 (General purpose I/O)  Input, pull-up resistor enabled
    P1.19:  PORT1.19 (General purpose I/O)  Input, pull-up resistor enabled
    P1.20:  PORT1.20 (General purpose I/O)  Input, pull-up resistor enabled
    P1.21:  PORT1.21 (General purpose I/O)  Input, pull-up resistor enabled
    P1.22:  PORT1.22 (General purpose I/O)  Input, pull-up resistor enabled
    P1.23:  PORT1.23 (General purpose I/O)  Input, pull-up resistor enabled
    P1.24:  PORT1.24 (General purpose I/O)  Input, pull-up resistor enabled
    P1.25:  PORT1.25 (General purpose I/O)  Input, pull-up resistor enabled
    P1.26:  PORT1.26 (General purpose I/O)  Input, pull-up resistor enabled
    P1.27:  PORT1.27 (General purpose I/O)  Input, pull-up resistor enabled
    P1.28:  PORT1.28 (General purpose I/O)  Input, pull-up resistor enabled
    P1.29:  PORT1.29 (General purpose I/O)  Input, pull-up resistor enabled
    P1.30:  PORT1.30 (General purpose I/O)  Input, pull-up resistor enabled
    P1.31:  PORT1.31 (General purpose I/O)  Input, pull-up resistor enabled
    P2.0:  PORT2.0 (General purpose I/O)  Input, pull-up resistor enabled
    P2.1:  PORT2.1 (General purpose I/O)  Input, pull-up resistor enabled
    P2.2:  PORT2.2 (General purpose I/O)  Input, pull-up resistor enabled
    P2.3:  PORT2.3 (General purpose I/O)  Input, pull-up resistor enabled
    P2.4:  PORT2.4 (General purpose I/O)  Input, pull-up resistor enabled
    P2.5:  PORT2.5 (General purpose I/O)  Input, pull-up resistor enabled
    P2.6:  PORT2.6 (General purpose I/O)  Input, pull-up resistor enabled
    P2.7:  PORT2.7 (General purpose I/O)  Input, pull-up resistor enabled
    P2.8:  PORT2.8 (General purpose I/O)  Input, pull-up resistor enabled
    P2.9:  PORT2.9 (General purpose I/O)  Input, pull-up resistor enabled
    P2.10:  PORT2.10 (General purpose I/O)  Input, pull-up resistor enabled
    P2.11:  PORT2.11 (General purpose I/O)  Input, pull-up resistor enabled
    P2.12:  PORT2.12 (General purpose I/O)  Input, pull-up resistor enabled
    P2.13:  PORT2.13 (General purpose I/O)  Input, pull-up resistor enabled
    P3.25:  PORT3.25 (General purpose I/O)  Input, pull-up resistor enabled
    P3.26:  PORT3.26 (General purpose I/O)  Input, pull-up resistor enabled
    P4.28:  PORT4.28 (General purpose I/O)  Input, pull-up resistor enabled
    P4.29:  PORT4.29 (General purpose I/O)  Input, pull-up resistor enabled
*/
 
    LPC_PINCON->PINSEL0=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE0=0x0003A050;     /* binary: 00000000_00000011_10100000_01010000 */
    LPC_GPIO0->FIODIR=0x00000003;     /* binary: 00000000_00000000_00000000_00000011 */
    LPC_PINCON->PINMODE_OD0=0x00010108;     /* binary: 00000000_00000001_00000001_00001000 */
    LPC_PINCON->PINSEL1=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE1=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINSEL2=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE2=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_GPIO1->FIODIR=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE_OD1=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINSEL3=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE3=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINSEL4=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE4=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_GPIO2->FIODIR=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE_OD2=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINSEL7=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE7=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_GPIO3->FIODIR=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE_OD3=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINSEL9=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE9=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_GPIO4->FIODIR=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_PINCON->PINMODE_OD4=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
 
/******************************************************************************
                           External interrupts
*******************************************************************************
    Ext. interrupt 0 mode: Edge sensitivity / Rising edge
*/
    LPC_SC->EXTMODE=0x01;     /* binary: 00000001 */
    LPC_SC->EXTPOLAR=0x01;     /* binary: 00000001 */
    LPC_SC->EXTINT=0x01;     /* clear the external interrupt flags */
 
/******************************************************************************
                                       GPIO interrupts
*******************************************************************************
    P0.0 : On falling edge
    P0.1 : On falling edge
    P0.4 : On both edges
    P0.6 : On rising edge
*/
    LPC_GPIOINT->IO0IntEnR=0x00000050;     /* binary: 00000000_00000000_00000000_01010000 */
    LPC_GPIOINT->IO0IntEnF=0x00000013;     /* binary: 00000000_00000000_00000000_00010011 */
    LPC_GPIOINT->IO2IntEnR=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
    LPC_GPIOINT->IO2IntEnF=0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
 
/******************************************************************************
                         Vectored Interrupt initialization
******************************************************************************/
 
   NVIC_EnableIRQ(TIMER0_IRQn);           /* Enable TIMER0 interrupt */
   NVIC_SetPriority(TIMER0_IRQn,0);          /* Default priority group 0, can be 0(highest) - 31(lowest) */
 
   NVIC_EnableIRQ(EINT0_IRQn);           /* Enable EINT0 interrupt */
   NVIC_SetPriority(EINT0_IRQn,0);          /* Default priority group 0, can be 0(highest) - 31(lowest) */
 
   NVIC_EnableIRQ(SPI_IRQn);           /* Enable SPI interrupt */
   NVIC_SetPriority(SPI_IRQn,0);          /* Default priority group 0, can be 0(highest) - 31(lowest) */
 
/******************************************************************************
                                           ADC0
*******************************************************************************
   ADC operational
   ADC clk: 3 MHz  (calculated with peripheral clock: 15MHz)
   ADC rate: 46,1538 Ksamples/sec
   manual mode, 60 clocks / 12 bit accuracy
   No start (only in manual mode, for burst always on)
   Channel 0 enabled, global DONE flag in ADGDR will generate an interrupt
   Channel 1 disabled, global DONE flag in ADGDR will generate an interrupt
   Channel 2 disabled, global DONE flag in ADGDR will generate an interrupt
   Channel 3 disabled, global DONE flag in ADGDR will generate an interrupt
   Channel 4 disabled, global DONE flag in ADGDR will generate an interrupt
   Channel 5 disabled, global DONE flag in ADGDR will generate an interrupt
   Channel 6 disabled, global DONE flag in ADGDR will generate an interrupt
   Channel 7 disabled, global DONE flag in ADGDR will generate an interrupt
*/
 
LPC_SC->PCONP |= 0x1000;      /* Enable peripheral clock for ADC (default is disabled) */
LPC_ADC->ADCR=0x00200401;     /* binary: 00000000_00100000_00000100_00000001 */
LPC_ADC->ADINTEN=0x00000100;     /* binary: 00000000_00000000_00000001_00000000 */
 
/******************************************************************************
                                 Timer0 (32bit)
*******************************************************************************
   Counter Disabled,    Counter Reset=0
   Timer mode: count on rising edge of PCLK
   Counter clk: 2 MHz, Counts every: 500 ns  (calculated with peripheral clock: 30MHz)
   MCR0.0 : generate interrupt on compare match
*/
LPC_TIM0->CTCR=0x00;     /* binary: 00000000 */
LPC_TIM0->TC=0x00000000;     /* decimal 0 */
LPC_TIM0->PR=0x0000000E;     /* decimal 14 */
LPC_TIM0->MCR=0x0001;     /* binary: 00000000_00000001 */
LPC_TIM0->MR0=0x000000C8;     /* decimal 200 */
LPC_TIM0->MR1=0x00000000;     /* decimal 0 */
LPC_TIM0->MR2=0x00000000;     /* decimal 0 */
LPC_TIM0->MR3=0x00000000;     /* decimal 0 */
LPC_TIM0->CCR=0x0000;     /* binary: 00000000_00000000 */
LPC_TIM0->EMR=0x0000;     /* binary: 00000000_00000000 */
LPC_TIM0->TCR=0x00;     /* binary: 00000000 */
 
   while(1)
  {
  
  
   }
 
}

 
Last edited:

Re: ARM7 (LCP21XX) register settings wizard?

ARMwizard updated to version 2.0.1

What is new
• Added support for LPC1751/52/54/56/58/59

I had to release v2.0.1 one day after v2.0 because I have added the LPC175x chips and I had to make a few changes in the application to work correctly with them (no capture registers are available in timer 2 and 3 in these chips).
A download of only the profiles wasn't an option, sorry for the inconvenience.

Visit my website through my profile, or download directly using **broken link removed**

Alex
 

Re: ARM7 (LCP21XX) register settings wizard?

ARMwizard updated to version 2.0.3b

What is new

v2.0.3b
• Fixed: The pclock is common only in LPC177x/8x. For LPC175x/6x there are individual divider settings

v2.0.3
• Fixed: the Pclock couldn't be set over 100MHz in LPC17xx ADC, now the limit is 200MHz [Johann Zimmermann]
• Fixed: in LPC17xx the Pclock divider is now common and can be set to 1/1 - 1/31

V2.0.2
• Removed: __irq prefix from LPC17xx functions [Phil Young LPC2000 forum]
• Added: The missing exception interrupts for LPC17xx
• Added: Bit masking for reserved bits of PCONP, SCS, INTWAKE registers
• Added: Support for LPC177x/8x having the IOCON register
• Added: In quick selector if a pin of a function group is set then the group is also shown with a checkbox
• Fixed: when the external match checkbox were enabled in timers the match control register stop and reset bits were disabled.
• Fixed: The motor PWM input pins were shown in the SD/MMC section of quick selector
• Fixed: a few pins functions in LPC2470/78 were not commented

Visit my website through my profile, or download directly using **broken link removed**

Best regards
Alex
 
Re: ARM7 (LCP21XX) register settings wizard?

Could the registers NOT presently supported be listed somewhere, or placed on a Misc tab?

For example, I couldn't find the RTC configuration registers anywhere.

Thanks for a great product!

PS: V2.0.3b runs great under 32-bit Ubuntu 11.10 + Wine 1.2.3.
 

Re: ARM7 (LCP21XX) register settings wizard?

I'm adding the peripheral tabs with all the related registers settings as I add new functionality to the application.
Having tabs with registers of peripherals that are not implemented would mean that there would be no settings so I don't see the point of setting a bunch of registers to the default value when you have to lookup at the user manual anyway in order to use them.
In addition I have to read a bunch of manuals each time I add a new peripheral in order to check which registers are available in each mcu and add them so even adding just the names would require a lot of time.
In addition I also have to check the keil header which often uses different names in the header (compared to the NXP user manual) in which case I use a set of defines in order for the original names to be working properly.

Thanks for the feedback on Ubuntu 11.10 + Wine 1.2.3.

Alex
 

I wasn't thinking of full support, but just a list of registers for the selected processor that don't have full support, that I can select to put a comment in the generated code to remind me to look it up and set it.

Perhaps an "Unsupported" tab with a sorted list of "extra" or "other" registers, a 1-line description, and a checkbox to add a comment for that register to the output.

And, maybe, an optional box to enter a hex or binary value, to be used after I do look it up. That way everything can reside within your app, even if is not fully supported..
 

Re: ARM7 (LCP21xx, 23xx, 24xx) & cortex M3 (LPC17xx) register settings wizard

ARMwizard updated to version 2.1 , added SPI/SSP settings

What is new:

• Fixed: There were cases where the CCR1.0 checkboxes were not shown for PWM
• Fixed: The PCLK divider range was 1/1 - 1/8 instead of 1/1 - 1/31 for LPC177x/8x
• Fixed: The PWM power control bits (PCONP) were not set to turn on the peripheral in LPC177x/8x
• Fixed: The ADC1 power control bits (PCONP) were not set to turn on the peripheral in LPC2134/36/38
• Fixed: There was an erron in the name of the included header for LPC2141
• Fixed: In LPC175x/6x the right click on the pull up/down triangle didn't change the mode correctly (from up<->down)
• Added: All edit box values can now be increased/decreased using the up/down arrow keys (like spin edits)
• Added: For desktops with vertical resolution lower than 660 the ARMwizard form is reduced to 550px and a scrollbar is shown
• Added: SPI/SSP settings for all the included mcu models
• Added: Set the power control bits (PCONP) to enable every used peripheral even if the default setting after reset is on

Visit **broken link removed**

Best regards
Alex

**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top