Need help: VT List corrupted

Discussions and support about ChibiOS/RT, the free embedded RTOS.
alexblack
Posts: 276
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 32 times
Contact:

Need help: VT List corrupted

Postby alexblack » Wed Oct 14, 2020 10:14 pm

Hi.
I was decided to change the main CPU in my project from STM32F407 to a new STM32G473 and update the ChibiOS from 16 to the current trunk, because new CPU start supported here.
The main problem is in that if I switch off all the DEBUG options of the CHIBIOS and set the high level of optimisations of the compilator the program hangs up after not regular periods of time in the following infinite loop:

Code: Select all

file "\ChibiOS\os\rt\src\chvt.c"
...
225 /* The delta list is scanned in order to find the correct position for
226      this timer. */
227   p = vtlp->next;
228   while (p->delta < delta) {
229     /* Debug assert if the timer is already in the list.*/
230     chDbgAssert(p != vtp, "timer already armed");
231
232     delta -= p->delta;
233     p = p->next;
234   }
...

This happenes because one of my virtual timers have NEXT pointer is pointed to itself:
vt_list.jpg

I do not understand how it hapens. If I set the code optimizations to off or switch on the debug options of the ChibiOS the problem is disappere and the program work two days without the crash.

Please help.
How to find the problem? On the old CPU there is no this problem. May be it is some kind of the RACE conditions?

p.s. I'm using periodic SYSTEM TIMER at 2000Hz rate.

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: Need help: VT List corrupted

Postby Giovanni » Thu Oct 15, 2020 6:10 am

Hi,

Are all your IRQ priorities beetween 3 and 15? Which compiler are you using?

Anyway, could you create a minimal project that shows the problem?

Giovanni

mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: Need help: VT List corrupted

Postby mikeprotts » Thu Oct 15, 2020 9:28 am

Does the STM32F407 work with the current trunk (i.e. your working old code/CPU combination ported to the ChibiOS trunk)?

Did you start with a new set of chconf.h, mcuconf.h & halconf.h (e.g. from the new trunk for the correct CPU demo or testhal) and then reapply your required settings? I've had odd problems in the past when I didn't do that.

Is the failure occurring in a thread/interrupt?

Mike

alexblack
Posts: 276
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 32 times
Contact:

Re: Need help: VT List corrupted

Postby alexblack » Thu Oct 15, 2020 2:25 pm

Giovanni wrote:Hi,
Are all your IRQ priorities beetween 3 and 15? Which compiler are you using?
Giovanni


Yes - all priorities beetween 3 and 15.
Compiler is Keil.

Giovanni wrote:Anyway, could you create a minimal project that shows the problem?
Giovanni


No - it is hard to reproduce the problem. It is appear only with full code in real hardware. If I started it in demo board - there is no problem - I waited all night.
Now I'm treing to localize the problem by switch off some parts of code. But time for hang up is more then hour. I need a lot of time to find whats wrong.

But I have another project with the same CPU and it works fine. A lot of code is common between this projects.

alexblack
Posts: 276
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 32 times
Contact:

Re: Need help: VT List corrupted

Postby alexblack » Thu Oct 15, 2020 2:43 pm

mikeprotts wrote:Does the STM32F407 work with the current trunk (i.e. your working old code/CPU combination ported to the ChibiOS trunk)?
Mike

This was first that I do - I ported old project on F407 to new ChibiOS. There were no problems at this moment. The hardware for the new CPU was changed and new project has some differents.

mikeprotts wrote:Did you start with a new set of chconf.h, mcuconf.h & halconf.h (e.g. from the new trunk for the correct CPU demo or testhal) and then reapply your required settings? I've had odd problems in the past when I didn't do that.

Is the failure occurring in a thread/interrupt?

It is not my first project on ChibiOS and for the STM32G473 I already have big projects - it works. I think it is not config problem.

First time the problem was in that the virtual timer "was lost" - I wait it and it did not fired. After some modifications the failure occuring in IRQ, after that in thread. But all time it is happened with virtual timers system.

The new, what I never used before in this project - it is that I used STM Peripheral Library to setup special mode of the TIM. May be it corrupt somthing. But Why it is not reproduced in debug mode.

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: Need help: VT List corrupted

Postby Giovanni » Thu Oct 15, 2020 3:18 pm

Hi,

Could you try to keep the state checker on?

Also, try to increase the "delta" parameter (if you are in tick-less mode).

Edit:: Anyway, I can see 2 ways this can happen:
1) Calling some timers I or S function outside a critical section.
2) Calling some timers function from an ISR with priority higher than 3 (that ca preempt critical sections).

I would verify the IRQ priorities by looking at NVIC registers.

Giovanni


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 5 guests