Reply by rtstofer September 1, 20112011-09-01
--- In l..., "lucky_suhas" wrote:
> thanks. i found a work around for it. i had to save my code on the existing example projects.. I did not understand how to use the information on that link. I do not even know what scatter files are. and my programming skills go only so far.

Here is a scatter file (.scf) for a typical LPC2148 project:

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x00000000 0x00080000 { ; load region size_region
ER_IROM1 0x00000000 0x00080000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x40000000 0x00008000 { ; RW data
.ANY (+RW +ZI)
}
}

I wouldn't expect any overlap problems with this file because the ZI sections are placed in RAM (where they belong).

This file should have been created by uVision when you set up a project and selected NXP LPC2148 for the target. You really shouldn't have to deal with it.

Richard

An Engineer's Guide to the LPC2100 Series

Reply by lucky_suhas September 1, 20112011-09-01
thanks. i found a work around for it. i had to save my code on the existing example projects.. I did not understand how to use the information on that link. I do not even know what scatter files are. and my programming skills go only so far.
--- In l..., "rtstofer" wrote:
>
> --- In l..., "lucky_suhas" wrote:
> >
> >
> > i tried 'build target' for compiling my code, it says there's a linking error and the two regions ER_RO and ER_ZI are overlapping. i wanted to know how i can fix this? i found something about scatter fields when i searched for the error code L6221E. i did not understand how to make use of that info.
> >
> > the link i found is here:
> >
> > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0496c/BABHAIBE.html
> >
> > thanks!
>
> If you follow this link from the page you referenced, you will see how to modify the scatter file using ImageLimit() to eliminate the overlap:
>
> http://infocenter.arm.com/help/topic/com.arm.doc.dui0493c/BABFJEAI.html
>
> I have only used the free version of Keil uVision4 so I don't have much experience with the toolchain. But one thing I know for certain: I didn't have to get involved with scatter files or the linker. I just created a project, added a couple of files and everything worked just fine.
>
> I used the Keil Startup.s and retarget.c but the rest of the files were mine. All I did was create a new project and select the NXP LPC2148. The editor asked about adding Startup.s and I'm not sure how I added retarget.c. It is required as it provides linkage between Keil's fputc() and my sendchar() function. fputc() is required by printf().
>
> Richard
>

Reply by rtstofer August 30, 20112011-08-30
--- In l..., "lucky_suhas" wrote:
> i tried 'build target' for compiling my code, it says there's a linking error and the two regions ER_RO and ER_ZI are overlapping. i wanted to know how i can fix this? i found something about scatter fields when i searched for the error code L6221E. i did not understand how to make use of that info.
>
> the link i found is here:
>
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0496c/BABHAIBE.html
>
> thanks!

If you follow this link from the page you referenced, you will see how to modify the scatter file using ImageLimit() to eliminate the overlap:

http://infocenter.arm.com/help/topic/com.arm.doc.dui0493c/BABFJEAI.html

I have only used the free version of Keil uVision4 so I don't have much experience with the toolchain. But one thing I know for certain: I didn't have to get involved with scatter files or the linker. I just created a project, added a couple of files and everything worked just fine.

I used the Keil Startup.s and retarget.c but the rest of the files were mine. All I did was create a new project and select the NXP LPC2148. The editor asked about adding Startup.s and I'm not sure how I added retarget.c. It is required as it provides linkage between Keil's fputc() and my sendchar() function. fputc() is required by printf().

Richard

Reply by lucky_suhas August 30, 20112011-08-30
i tried 'build target' for compiling my code, it says there's a linking error and the two regions ER_RO and ER_ZI are overlapping. i wanted to know how i can fix this? i found something about scatter fields when i searched for the error code L6221E. i did not understand how to make use of that info.

the link i found is here:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0496c/BABHAIBE.html

thanks!
--- In l..., "Bertrik Sikken" wrote:
>
> I suppose the error you're getting is documented in the documentation of
> your toolchain. What is your question exactly?
>
> Kind regards,
> Bertrik
>
> > getting this error when i try to compile the file
> >
> > adc.axf: Error: L6221E: Execution region ER_RO with Execution range
> > [0x00000000,0x000002bc) overlaps with Execution region ER_ZI with
> > Execution range [0x00000000,0x00000060).
> >
> > --- In l..., "Alexan_e" wrote:
> >>
> >> The periphepal clock (Pclock) is divided with the CLKDIV value +1 ,
> >> CLKDIV are bits 15:8 as you said
> >>
> >> try ARMwizard, it can make the calculations and initialization code for
> >> you
> >> http://alexan.edaboard.eu
> >>
> >> Alex
> >>
> >> ----- Original Message -----
> >> From: lucky_suhas
> >> To: l...
> >> Sent: Sunday, August 28, 2011 4:44 PM
> >> Subject: [lpc2000] Re: errors in my ADC code for LPC2148 (beginner)
> >>
> >>
> >>
> >>
> >> you are right. i failed to notice that. thanks for pointing it out.
> >> about that CLKDIV bits, how does it divide the frequency? does the
> >> PCLK get divided by the decimal equivalent of the bits 15:8 of AD0CR?
> >> --- In l..., Bertrik Sikken wrote:
> >> >
> >> > On 28-8-2011 12:07, lucky_suhas wrote:
> >> > > AD0CR=0x00200000 & (1< > >> >
> >> > This looks weird. Didn't you mean to use | instead of & ?
> >> >
> >> > Also, I think you should set CLKDIV in AD0CR too, otherwise
> >> > you might be configuring it to run way too fast.
>

Reply by Bertrik Sikken August 30, 20112011-08-30
I suppose the error you're getting is documented in the documentation of
your toolchain. What is your question exactly?

Kind regards,
Bertrik

> getting this error when i try to compile the file
>
> adc.axf: Error: L6221E: Execution region ER_RO with Execution range
> [0x00000000,0x000002bc) overlaps with Execution region ER_ZI with
> Execution range [0x00000000,0x00000060).
>
> --- In l..., "Alexan_e" wrote:
>>
>> The periphepal clock (Pclock) is divided with the CLKDIV value +1 ,
>> CLKDIV are bits 15:8 as you said
>>
>> try ARMwizard, it can make the calculations and initialization code for
>> you
>> http://alexan.edaboard.eu
>>
>> Alex
>>
>> ----- Original Message -----
>> From: lucky_suhas
>> To: l...
>> Sent: Sunday, August 28, 2011 4:44 PM
>> Subject: [lpc2000] Re: errors in my ADC code for LPC2148 (beginner)
>> you are right. i failed to notice that. thanks for pointing it out.
>> about that CLKDIV bits, how does it divide the frequency? does the
>> PCLK get divided by the decimal equivalent of the bits 15:8 of AD0CR?
>> --- In l..., Bertrik Sikken wrote:
>> >
>> > On 28-8-2011 12:07, lucky_suhas wrote:
>> > > AD0CR=0x00200000 & (1< >> >
>> > This looks weird. Didn't you mean to use | instead of & ?
>> >
>> > Also, I think you should set CLKDIV in AD0CR too, otherwise
>> > you might be configuring it to run way too fast.

Reply by lucky_suhas August 30, 20112011-08-30
getting this error when i try to compile the file

adc.axf: Error: L6221E: Execution region ER_RO with Execution range [0x00000000,0x000002bc) overlaps with Execution region ER_ZI with Execution range [0x00000000,0x00000060).

--- In l..., "Alexan_e" wrote:
>
> The periphepal clock (Pclock) is divided with the CLKDIV value +1 , CLKDIV are bits 15:8 as you said
>
> try ARMwizard, it can make the calculations and initialization code for you
> http://alexan.edaboard.eu
>
> Alex
>
> ----- Original Message -----
> From: lucky_suhas
> To: l...
> Sent: Sunday, August 28, 2011 4:44 PM
> Subject: [lpc2000] Re: errors in my ADC code for LPC2148 (beginner)
>
>
> you are right. i failed to notice that. thanks for pointing it out.
> about that CLKDIV bits, how does it divide the frequency? does the PCLK get divided by the decimal equivalent of the bits 15:8 of AD0CR?
> --- In l..., Bertrik Sikken wrote:
> >
> > On 28-8-2011 12:07, lucky_suhas wrote:
> > > AD0CR=0x00200000 & (1< > >
> > This looks weird. Didn't you mean to use | instead of & ?
> >
> > Also, I think you should set CLKDIV in AD0CR too, otherwise
> > you might be configuring it to run way too fast.
> >
> > Kind regards,
> > Bertrik
>

Reply by Mukund Deshmukh August 29, 20112011-08-29
>>>
>>>
>>> one last thing, in the main() i'm just using the 'result' to get the value here because i do not know what else i can do with it. if i am to load my code on to the board what do you suggest i do with the ADC data? i'm just trying to learn so anything you could tell me would be helpful.
>>>
>>> Thanks for reading.
>>>

--
Well, you can send the ADC data to serial port. If you have used ISP,
then your serial port is already connected to PC. Simply configure
serial port and send two byte ( for 10 bit data).

Best Regards,
Mukund Deshmukh
Beta Computronics Pvt Ltd
10/1, IT Park, Parsodi
Nagpur, India
Meet us at Booth No 1.1D09,
CHINAPLAS 2011- GUANGZHOU-CHINA

Reply by Alexan_e August 28, 20112011-08-28
The periphepal clock (Pclock) is divided with the CLKDIV value +1 , CLKDIV are bits 15:8 as you said

try ARMwizard, it can make the calculations and initialization code for you
http://alexan.edaboard.eu

Alex

----- Original Message -----
From: lucky_suhas
To: l...
Sent: Sunday, August 28, 2011 4:44 PM
Subject: [lpc2000] Re: errors in my ADC code for LPC2148 (beginner)

you are right. i failed to notice that. thanks for pointing it out.
about that CLKDIV bits, how does it divide the frequency? does the PCLK get divided by the decimal equivalent of the bits 15:8 of AD0CR?
--- In l..., Bertrik Sikken wrote:
>
> On 28-8-2011 12:07, lucky_suhas wrote:
> > AD0CR=0x00200000 & (1< >
> This looks weird. Didn't you mean to use | instead of & ?
>
> Also, I think you should set CLKDIV in AD0CR too, otherwise
> you might be configuring it to run way too fast.
>
> Kind regards,
> Bertrik
>
Reply by lucky_suhas August 28, 20112011-08-28
you are right. i failed to notice that. thanks for pointing it out.
about that CLKDIV bits, how does it divide the frequency? does the PCLK get divided by the decimal equivalent of the bits 15:8 of AD0CR?
--- In l..., Bertrik Sikken wrote:
>
> On 28-8-2011 12:07, lucky_suhas wrote:
> > AD0CR=0x00200000 & (1< >
> This looks weird. Didn't you mean to use | instead of & ?
>
> Also, I think you should set CLKDIV in AD0CR too, otherwise
> you might be configuring it to run way too fast.
>
> Kind regards,
> Bertrik
>

Reply by lucky_suhas August 28, 20112011-08-28
i'm sorry i for got to correct that one part before posting it. is everything else proper? any suggestions or tips you might have will be quite helpful.

--- In l..., "Matthias" wrote:
>
> Check your brackets in init_adc0(), you have more closing than opening brackets per line.
>
> --- In l..., "lucky_suhas" wrote:
> >
> > Hi,
> > i have just started learning to use the LPC2148. the code is for using one of the channels in ADC0.i tried compiling my code and there seems to be something wrong. i'm getting an
> >
> > "Error: C9932E"
> >
> > in "keil".
> >
> > the purpose of the code is to see how adc works on this micro-controller.
> > could anyone tell me what i am doing wrong?
> > my code is as below:
> >
> > #include
> >
> > void init_adc0(void)
> > {
> > PINSEL0 = (PINSEL0 & ~(3 << 8)) | (3 << 8)& ~(3 << 10)) | (3 << 10);
> > PINSEL1=(PINSEL1 & ~(3 << 18)) | (1 << 18)& ~(3 << 24)) | (1 << 24)& ~(3 << 26)) | (1 << 26)& ~(3 << 28)) | (1 << 28);
> > }
> >
> > unsigned adc_read(unsigned char ch_no)
> > {
> > AD0CR=0x00200000 & (1< > >
> > do
> > {
> > i = AD0GDR; // Read A/D Data Register
> > } while ((i & 0x80000000) == 0); // Wait for end of A/D
> >
> > return ((i>>6) & 0x3FF);
> > }
> >
> > void main(void)
> > {
> > init_adc0();
> > resultc_read(2); //ch_no 7:6;4:1
> > }
> >
> >
> > one last thing, in the main() i'm just using the 'result' to get the value here because i do not know what else i can do with it. if i am to load my code on to the board what do you suggest i do with the ADC data? i'm just trying to learn so anything you could tell me would be helpful.
> >
> > Thanks for reading.
>