VICVectAddr In LPC17xx.h

Questions about the BASICtools and MakeItC
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

VICVectAddr In LPC17xx.h

Post by danlee58 »

In LPC17xx.h, VICVectAddr is defined as one location, but there are 8 locations for VICVectCntlx.

In LPC21xx.h VICVectAddrx is defined at 16 locations, and there are 16 VICVectCntlx locations.

Shouldn't there be 8 VICVectAddrx locations defined in LPC17xx.h?



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: VICVectAddr In LPC17xx.h

Post by basicchip »

The ARM7 uses a VIC which shares interrupt vectors among sources in the 16 possible locations.

The Cortex parts are very different using an NVIC, which for the most part reserves one location for each source. These vectors are located in low memory (in BASIC in RAM remapped to 0x00000000, in C its up to you, but you can keep them in Flash if they are static and defined in startup_cortex.S )

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: VICVectAddr In LPC17xx.h

Post by danlee58 »

I have setup my PINSELs for AD2, AD4, AD5, & the DAC on the SuperPro. I have also setup the Power, clock, & control registers for these. I setup Timer0 & CAP1.0 for Interrupt on Capture.

I need to set the Interrupt Vector for the Interrupt proceedure that will reset Timer0 on Capture. The Vector address is VICVectAddr + offset 0x44.

How do I assign the Vector to the Address in my program? Do I redefine VICVectAddr?

I get an error when I add 0x44 to VICVectAddr in an assignment statement.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: VICVectAddr In LPC17xx.h

Post by basicchip »

For most users, the interrupt vectors will not change, and they are all defined in startup_cortex.S . For instance you will find a vector for TIMER0_IRQHandler . At the end of the file you will see a definition for all the interrupts in the form of .weak TIMER0_IRQHandler .

What the weak definition means is that if that routine is not defined elsewhere this default definition is used.

So if you want to use a TIMER0 interrupt, you just need to define the TIMER0_IRQHandler in your code and that will take precedence over the default definition.

These vectors are in Flash so you can not in a C statement assign a value to it, that would generate an exception.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: VICVectAddr In LPC17xx.h

Post by danlee58 »

My SuperPro arrived today and I downloaded my compiled C code. I get the following error:

FaultISR 0xFFFFFFF9 SCB->CFSR=0x00000400

I can compile Csample.c, and download it without a problem. The LED goes 'ON', when I write a 1 from the Terminal, and it goes 'OFF', when I write a 2.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: VICVectAddr In LPC17xx.h

Post by danlee58 »

I found 2 problems in my setup code. One is in the Power Control, and the other is in the ADC Control. It's the ADC Control that causes the error code above.

Otherwise the code runs. After I find the cause & fix the problems, I'll do some preliminary testing. As of now, I get a repeating Statement from a printf in my program. I know it's going through the Main Loop. What else is happening is TBD.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: VICVectAddr In LPC17xx.h

Post by basicchip »

The default state of power to the ADC in the LPC175x is turned off following reset in LPC_SC->PCONP, look at our initialization code or the user manual to turn it on.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: VICVectAddr In LPC17xx.h

Post by danlee58 »

I fixed the Power Control problem. I was turning off the UART, when I was setting the power to the ADC.

I still have a problem with the ADC Control Register. I set that register to 0x00210134, but I get the above error message with that configuration. If I don't set the ADC Control Register, the program runs.

I set the ADC control for ADC Operational, Burst Mode, APB Clock Divider = 2, & AD2, 4, 5 enabled.

I'll try other clock dividers.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: VICVectAddr In LPC17xx.h

Post by danlee58 »

The ADC Control Register problem seems to occur whenever I write to the ADC Control Register. The content doesn't affect it. The register is located at 0x40034000. If I comment out the write to the ADC Control Register, and read & print the contents, they are 0.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: VICVectAddr In LPC17xx.h

Post by basicchip »

If you are doing software starts, the BURST_MODE bit should not be set.

Either copy our code from adc.c or run Csample.c and copy our register settings, one of the options in that program drops you into our breakpoint routine.

Post Reply