Set Interrupt Event Handler

Universal Programmable Converter for CAN FD and CAN
Post Reply
remi.deparis@stellantis.com
Posts: 8
Joined: Mon 17. May 2021, 11:27

Set Interrupt Event Handler

Post by remi.deparis@stellantis.com » Thu 27. May 2021, 13:53

hello
To simply my main loop, I would like to create an EventHandler
on a Timer (eg: every 10 ms) (TIMER0_IRQ ?)
and RS232 (UART0_IRQHandler ?)

but I don't have any example or doc to handle it:
I see on startup_ARMCM4.c
all IRQ are setted to Default Handler (while(1))
eg :
void TIMER0_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler")));

did you already implement any function that allows me to handle a ticker and RS232 reception , or should I directly modify this file ?

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Set Interrupt Event Handler

Post by M.Heidemann » Fri 28. May 2021, 10:08

Hello,

We have relayed your request to our development-team and we will report back
to you with more information regarding this.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Set Interrupt Event Handler

Post by M.Heidemann » Fri 28. May 2021, 12:37

Hello,

We have received feedback from our development team:

In case of the RTC you could define your own interrupt handler, which will
overwrite the default handler:

Code: Select all

    void  TIMER0_IRQHandler ( void)
{​​​​​​​
//Your Code
}​​​​​​​
For the RS-232 Interrupts the procedure is similar, you will however
need to make sure that you use a custom name for the handler, as "UART0_IRQHandler " does exist
in the lib (UART0_IRQHandler .a) and will cause conflicts.
In both instances we highly recommend to refer to the documentation for
the used NXP LPC4078.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

remi.deparis@stellantis.com
Posts: 8
Joined: Mon 17. May 2021, 11:27

Re: Set Interrupt Event Handler

Post by remi.deparis@stellantis.com » Fri 28. May 2021, 13:25

Thank you very much for your rapid answer and complet one

clearly I means that I need to update the startup_ARMCM4.c with my Interrupt program name?

How should I set the timeElapsed (10ms) for IRQ Timer?

I just need to know With IRQ number (UART0?) is assign to the PCAN RS232 serial port ?
you said you handle IRQ UART0, did you do sth which I need to take care of it ?

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Set Interrupt Event Handler

Post by M.Heidemann » Fri 28. May 2021, 15:32

Hello,

I will check back with our developer regarding this and will
report back to you with the appropiate information.


Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Set Interrupt Event Handler

Post by M.Heidemann » Tue 1. Jun 2021, 15:08

Hello,

After getting back with our developers, i can say the following:
clearly I means that I need to update the startup_ARMCM4.c with my Interrupt program name?
Yes, you will have to replace this with your interrupt handler :

UART0_IRQHandler

replace with (for Example)

UART0_User_IRQHandler

You will of course need to configure the Interrupt , etc,
as this is not handled from the lib anymore at this point.

// uart config
LPC_UART0->LCR = 1 << 7; // set DLAB
LPC_UART0->DLL = reload;
LPC_UART0->DLM = reload >> 8;
...


// IRQ enable
NVIC_EnableIRQ ( UART0_IRQn);

For the timer interrupt implementation, you'll also have to declare your own interrupt for it.
You can take a look at example "03_timer" for reference.

Also, have a look at the reference manual for LPC408x/407x, as most of this
documented in the reference manual:

https://www.nxp.com/docs/en/user-guide/UM10562.pdf


Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

remi.deparis@stellantis.com
Posts: 8
Joined: Mon 17. May 2021, 11:27

Re: Set Interrupt Event Handler

Post by remi.deparis@stellantis.com » Thu 3. Jun 2021, 14:49

hello
thank you for your feed back ,
regarding irq_timer every 10ms (like tick), NXP document propose to overload the method sysTick_handler(). I saw you propose a "weak" implementation in statup_ARMCM4.c file

may i wrong if I implement the tick like this ?

Code: Select all

void (*sysTimeIRQ) (void) ;

void init_sysTick(uint32_t timeMs)
{
	SysTick_Config(SystemCoreClock /(timeMs) );
}
void SysTick_attach (void (*fct)(void),uint32_t timeMs)
{
	init_sysTick(timeMs);
	sysTimeIRQ = fct;
}
void SysTick_Handler ()
{	sysTimeIRQ();
}
kind regards

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Set Interrupt Event Handler

Post by M.Heidemann » Fri 4. Jun 2021, 15:38

Hello,

We do not support the LPC408x/407x platform directly.

Our implementation may differ from yours, feel free to us another implemenation
better suited for your application.

We'd recommend to get involved with a community speclialized in development
for these platforms, we provide support for devices, which happen to use this microcontroller.

Once we talk about certain implementations of fucntions on LPC408x/407x itself,
this goes beyond the scope of support that we can provide.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

remi.deparis@stellantis.com
Posts: 8
Joined: Mon 17. May 2021, 11:27

Re: Set Interrupt Event Handler

Post by remi.deparis@stellantis.com » Fri 4. Jun 2021, 23:01

Thanks à lot got it

Post Reply