Timers & TIVA port

ChibiOS public support forum for topics related to the Texas Instruments Tiva family of micro-controllers.

Moderator: Marco

mandrake
Posts: 6
Joined: Thu Dec 11, 2014 8:49 am

Timers & TIVA port

Postby mandrake » Thu Dec 11, 2014 8:58 am

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.

Marco
Posts: 124
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: Timers & TIVA port

Postby Marco » Thu Dec 11, 2014 9:29 am

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

mandrake
Posts: 6
Joined: Thu Dec 11, 2014 8:49 am

Re: Timers & TIVA port

Postby mandrake » Thu Dec 11, 2014 9:55 am

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.

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

Re: Timers & TIVA port

Postby Giovanni » Thu Dec 11, 2014 9:56 am

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

mandrake
Posts: 6
Joined: Thu Dec 11, 2014 8:49 am

Re: Timers & TIVA port

Postby mandrake » Thu Dec 11, 2014 10:16 am

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.

Marco
Posts: 124
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: Timers & TIVA port

Postby Marco » Thu Dec 11, 2014 10:56 am

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

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

Re: Timers & TIVA port

Postby Giovanni » Thu Dec 11, 2014 10:57 am

The fact that chDbgCheckClassS() detects an error is VERY strange, the problem apparently is not in your code.

What toolchain are you using?

Giovanni

mandrake
Posts: 6
Joined: Thu Dec 11, 2014 8:49 am

Re: Timers & TIVA port

Postby mandrake » Thu Dec 11, 2014 11:51 am

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.

Marco
Posts: 124
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: Timers & TIVA port

Postby Marco » Thu Dec 11, 2014 8:55 pm

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?

mandrake
Posts: 6
Joined: Thu Dec 11, 2014 8:49 am

Re: Timers & TIVA port

Postby mandrake » Thu Dec 11, 2014 10:03 pm

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.


Return to “Tiva Support”

Who is online

Users browsing this forum: No registered users and 1 guest