Page 1 of 2

Timers & TIVA port

Posted: Thu Dec 11, 2014 8:58 am
by mandrake
Hi, I tried the TIVA port and had problems with timer related code.
Specifically, every time I use chThreadSleep*() the system fails in chSchGoSleepTimeoutS(), when calling chDbgCheckClassS().
I am not sure where to start debugging this malfunctioning, so I ask you:

- Where can I look in order to debug this problem?
- May it be related to an incomplete/buggy implementation of timer related drivers?

Thank you in advance.

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 9:29 am
by Marco
Hello mandrake,

What specific Tiva part are you using?
What are your system timer settings in chconf.h?

It is known the tickless mode for the system tick is not working right now, only a system tick using the systick timer. Maybe this is the problem?
ChibiStudio might be a usefull IDE to debug this problem, and of course other problems. The only problem with this is that it needs some custom setup as ChibiStudio is not yet shipped with ChibiOS 3.

Marco

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 9:55 am
by mandrake
I'm using the TM4C1294 part, with a demo copied from the one I guess you wrote.
I didn't touch the chconf.h, nevertheless here is the code:
- chconf.h: http://pastebin.com/MKUAJSyG
- main.c: http://pastebin.com/Aj0zvgxF

Just to be clear, I don't know very much about ChibiOS since I started using it a few days ago, so I'm sorry if I bother you with stupid questions.

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 9:56 am
by Giovanni
Hi,

The failure could be a stack overflow, do you have debug options enabled in chconf.h? in case of failure the system halts and the parameter of the halt functions points to an error string that can be inspected using a debugger.

Giovanni

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 10:16 am
by mandrake
Well, I tried a less ortodox solution turning on a led immediately before the chDbgPanic(), in chDbgCheckClassS() as I said.
The led turns on so I guess it actually fails.
I don't have idea how to use the debugging features, if I need extra hardware I don't have it, so I had to use this other solution.

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 10:56 am
by Marco
As far I can see there should be no problem in the files. Is the provided demo working correct?

No problem mandrake, there are no stupid questions ;)

For the debugging features you don't need extra hardware, assuming you are using the Connected Launchpad board. You can debug the board using gdb and openocd 0.9 beta.
I will write a small guide to setup ChibiStudio for Tiva development this afternoon when i'm home.

Marco

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 10:57 am
by Giovanni
The fact that chDbgCheckClassS() detects an error is VERY strange, the problem apparently is not in your code.

What toolchain are you using?

Giovanni

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 11:51 am
by mandrake
What do you mean by toolchain?
I ported Marco's code on ChibiOS 2.6, but even trying the original code (written on top of ChibiOS 3) the sleep syscalls fail.
To be completely honest I just helped a friend of mine, who is the one actually owning the TIVA hardware.
I compile using directly the Makefile, I don't know if there are other options, I'm a bit confused by your question.

Anyhow, the situation is:
- Tiva code from ChibiOS-Contrib (based on ChibiOS 3) + the demo linked in my previous post -> failure on chThdSleepMilliseconds(), specifically in chDbgCheckClassS().
- Tiva code ported on ChibiOS 2.6 + the same demo -> same problem.

I hope this info can help.

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 8:55 pm
by Marco
Giovanni probably means what version of for example gcc you are using.

The Tiva port is designed to work with ChibiOS 3 and is not tested with earlier versions. This is probably one of the reasons why it's not working.

I looked at your files again and it seems the chconf.h file is not the same file as the chconf.h file from the contrib repository, i think you have a file from ChibiOS 2.6 or so. Can you try to compile your program again with a correct chconf.h file?

Re: Timers & TIVA port

Posted: Thu Dec 11, 2014 10:03 pm
by mandrake
Of course, it is your code "translated" in order to work on ChibiOS 2.6, but since neither the one from ChibiOS-Contrib "vanilla" is working I think that's not the problem.