Keil Logo

How to define the interrupt function ( UART0 )

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
MAHDI DAMIRCHILU
Posted
24-Nov-2018 10:12 GMT
Toolset
ARM
New! How to define the interrupt function ( UART0 )

hi
i whant define function "UART0_IRQHandler" in my library ( uart library )
but i dont whant use
#include <lpc17xx.h>
and
startup_LPC17xx.s

I tried this code but did not work
void (*test) (void) = (void (*) (void)) 0x54;

in file "LPC176x/5x User manual ( UM10360 )" and "Table 50" :

Interrupt_ID : 5
Exception_Number : 21
Vector_Offset : 0x54
Function : UART0
Flag(s) : Rx Line Status (RLS) Transmit Holding Register Empty (THRE) Rx Data Available (RDA) Character Time-out Indicator (CTI) End of Auto-Baud (ABEO) Auto-Baud Time-Out (ABTO)

Author
Andrew Neil
Posted
24-Nov-2018 10:38 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

http://www2.keil.com/mdk5/learn

http://www.keil.com/support/man/

http://www.keil.com/appnotes/

http://www.keil.com/books/

And don't forget resources from the chip manufacturer:

http://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc1700-cortex-m3:MC_1403790745385

http://www.nxp.com/support/developer-resources:DEVELOPER_HOME

Author
Westonsupermare Pier
Posted
25-Nov-2018 01:18 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

So why discard all the available methods? At least they were coded by people who had a grasp of what they were doing and what the processor is expecting.

Author
MAHDI DAMIRCHILU
Posted
25-Nov-2018 08:47 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

i define all register and i whant define all interrupt function - i dont love use default library keil -

Author
MAHDI DAMIRCHILU
Posted
25-Nov-2018 08:49 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

dif register for uart :

class UART { // Table 271 public : volatile uint32_t *RBR[4] = { // DLAB = 0, RO (uint32_t *)0x4000C000, (uint32_t *)0x40010000, (uint32_t *)0x40098000, (uint32_t *)0x4009C000 }; volatile uint32_t *THR[4] = { // DLAB = 0, WO (uint32_t *)0x4000C000, (uint32_t *)0x40010000, (uint32_t *)0x40098000, (uint32_t *)0x4009C000 }; volatile uint32_t *DLL[4] = { // DLAB = 1, R/W (uint32_t *)0x4000C000, (uint32_t *)0x40010000, (uint32_t *)0x40098000, (uint32_t *)0x4009C000 }; volatile uint32_t *DLM[4] = { // DLAB = 1 (uint32_t *)0x4000C004, (uint32_t *)0x40010004, (uint32_t *)0x40098004, (uint32_t *)0x4009C004 }; volatile uint32_t *IER[4] = { // DLAB = 0 (uint32_t *)0x4000C004, (uint32_t *)0x40010004, (uint32_t *)0x40098004, (uint32_t *)0x4009C004 }; volatile uint32_t *IIR[4] = { // RO (uint32_t *)0x4000C008, (uint32_t *)0x40010008, (uint32_t *)0x40098008, (uint32_t *)0x4009C008 }; volatile uint32_t *FCR[4] = { // WO (uint32_t *)0x4000C008, (uint32_t *)0x40010008, (uint32_t *)0x40098008, (uint32_t *)0x4009C008 }; volatile uint32_t *LCR[4] = { (uint32_t *)0x4000C00C, (uint32_t *)0x4001000C, (uint32_t *)0x4009800C, (uint32_t *)0x4009C00C }; volatile uint32_t *U1MCR = (uint32_t *)0x40010010; // Just for UART1 volatile uint32_t *LSR[4] = { (uint32_t *)0x4000C014, (uint32_t *)0x40010014, (uint32_t *)0x40098014, (uint32_t *)0x4009C014 }; volatile uint32_t *U1MSR = (uint32_t *)0x40010018; // Just for UART1 volatile uint32_t *SCR[4] = { (uint32_t *)0x4000C01C, (uint32_t *)0x4001001C, (uint32_t *)0x4009801C, (uint32_t *)0x4009C01C }; volatile uint32_t *ACR[4] = { (uint32_t *)0x4000C020, (uint32_t *)0x40010020, (uint32_t *)0x40098020, (uint32_t *)0x4009C020 }; volatile uint32_t *U0ICR = (uint32_t *)0x4000C024; // Just for UART0 volatile uint32_t *U2ICR = (uint32_t *)0x40098024; // Just for UART2 volatile uint32_t *U3ICR = (uint32_t *)0x4009C024; // Just for UART3 volatile uint32_t *FDR[4] = { (uint32_t *)0x4000C028, (uint32_t *)0x40010028, (uint32_t *)0x40098028, (uint32_t *)0x4009C028 }; volatile uint32_t *TER[4] = { (uint32_t *)0x4000C030, (uint32_t *)0x40010030, (uint32_t *)0x40098030, (uint32_t *)0x4009C030 }; volatile uint32_t *U1RS485CTRL = (uint32_t *)0x4001004C; // Just for UART1 volatile uint32_t *U1ADRMATCH = (uint32_t *)0x40010050; // Just for UART1 volatile uint32_t *U1RS485DLY = (uint32_t *)0x40010054; // Just for UART1
};

Author
MAHDI DAMIRCHILU
Posted
25-Nov-2018 08:50 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

wtf - sry - see this link ( dif register for uart ) -
http://paste.debian.net/1053156/

Author
MAHDI DAMIRCHILU
Posted
25-Nov-2018 19:06 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

pls help me - i need define interrupt function in my project but i dont whant use this file :
"startup_LPC17xx.s"

==========
i define all register and clock setting and i removed "startup_LPC17xx.c"
but i cant define interrupt function in my project

no person cant help me?

Author
Robert McNamara
Posted
26-Nov-2018 05:36 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

Until you understand what startup_LPC17xx.s does, you will not be able to add its functionality somewhere else and add your own interrupt handler routines.

fortunately, if you do use startup_LPC17xx.s, you can just write a c function with the same name as in startup_LPC17xx.s and the Default handler will be replaced with your function.

In main (or somewhere)

void UART0_HandlerIRQ(void)
{
    your code here
}

Will cause your UART0_HandlerIRQ{) function to be called every time it is activated.

You really do need to understand what startup_LPC17xx.s does before you can remove it. it is only about 250 lines. It would be helpful if you did not post again until you understand what startup_LPC17xx.s does and how you plan on making sure startup happens properly without using startup_LPC17xx.s

Author
Andrew Neil
Posted
26-Nov-2018 08:36 GMT
Toolset
None
New! RE: wtf - sry - see this link ( dif register for uart )

The instructions for posting source code are simple, and clearly stated.

See: http://www.danlhenry.com/caps/keil_code.png

Author
Andrew Neil
Posted
26-Nov-2018 11:11 GMT
Toolset
None
New! RE: i dont love use default library keil

That's no reason not to look at what they (and others) have done, and learn from it.

If you want to build from first principles, then you'll need some good references:

http://infocenter.arm.com/

http://www.keil.com/books/armbooks.asp

In particular, I would recommend Joseph Yiu's Definitive Guide series.

Author
Ron Wedge
Posted
29-Nov-2018 03:55 GMT
Toolset
ARM
New! RE: How to define the interrupt function ( UART0 )

In a Cortex-M3 device, the Nested Vector Interrupt Controller (NVIC) and the processor core interface are closely coupled, which enables low latency interrupt processing
The device handles interrupts. This coupling means that are rules that need to be followed in setting up the vector table, including the order in the table, and how to place the initial stack pointer.

See more at:

https://developer.arm.com/docs/ddi0337/e/nested-vectored-interrupt-controller/about-the-nvic

You can learn about the parts of a startup file here:
http://www.keil.com/pack/doc/CMSIS/Core/html/group__NVIC__gr.html

As a warning, if you do not use the startup file that NXP provides, you will find it harder to get help from others for using non-standard code.

If you want to write your own startup file, I suggest taking an online class about the Cortex-M architecture.

https://www.arm.com/resources/education/online-courses/efficient-embedded-systems

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.