Chibios thirdparty IRQ support

Discussions and support about ChibiOS/RT, the free embedded RTOS.
User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Chibios thirdparty IRQ support

Postby Giovanni » Mon May 14, 2018 7:59 am

I would verify again IRQ priorities, including systick, inspect the NVIC registers in order to confirm.

It is possible to use the tickless mode, you need to provide the same timer interface like the HAL ST driver does. Note that the port can include an user header for this:

Code: Select all

#if CH_CFG_ST_TIMEDELTA > 0
#if PORT_USE_ALT_TIMER == FALSE
#include "chcore_timer.h"
#else /* PORT_USE_ALT_TIMER != FALSE */
#include "chcore_timer_alt.h"
#endif /* PORT_USE_ALT_TIMER != FALSE */
#endif /* CH_CFG_ST_TIMEDELTA > 0 */


Put your implementation in a "chcore_timer_alt.h" and put -DPORT_USE_ALT_TIMER=1 in your Makefile. You can take the implemetation from hal_st_lld.c/.h.

Giovanni

rogtalha
Posts: 11
Joined: Mon Apr 30, 2018 1:56 pm

Re: Chibios thirdparty IRQ support

Postby rogtalha » Mon May 14, 2018 3:06 pm

Yes i checked the IRQ priorities.

Here are the results from gdb

a) SysTick_IRQn

Code: Select all

0xe000ed23:     01000000 // Its at 4. Above PendSV and SVCall as suggested.


b) DMA1_Stream1_IRQn

Code: Select all

(gdb) x/tb 0xe000e40c
0xe000e40c:     10000000   // Above Systick, at 8


c) USART3_IRQn

Code: Select all

(gdb) x/tb 0xe000e427
0xe000e427:     10000000


Both USART and DMA IRQ's sit at 8, but still hog all the cpu time once turned on. I set a breakpoint at the SysTick exception handler entry, when the usart and dma irq's are turned on. The system never serves Systick. Am i missing some configuration macro or system setting?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Chibios thirdparty IRQ support

Postby Giovanni » Mon May 14, 2018 3:36 pm

Have you configured and enabled the SysTick, the system does not do that for you, it is done in HAL usually.

Giovanni

rogtalha
Posts: 11
Joined: Mon Apr 30, 2018 1:56 pm

Re: Chibios thirdparty IRQ support

Postby rogtalha » Tue May 15, 2018 1:31 am

yup here is the code i am using for it.

Code: Select all

void init()
  {   
    //Initializing the Systick Timer
    SysTick->LOAD = SYSTEM_CLOCK / CH_CFG_ST_FREQUENCY - (systime_t)1;
    NVIC_SetPriority(SysTick_IRQn,(1UL << __NVIC_PRIO_BITS) - 12UL);   //assuming __NVIC_PRIO_BITS=4
    SysTick->VAL = (uint32_t)0;
    SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk |
                  SysTick_CTRL_TICKINT_Msk;       
   
  }

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Chibios thirdparty IRQ support

Postby Giovanni » Tue May 15, 2018 7:21 am

Hi,

Are you compiling with -O2? that could explain the missed breakpoint, try -O0.

Giovanni


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 2 guests