Ext driver example
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Ext driver example
You signal the thread using that variable "tp", do you assign it with the pointer to the thread?
It would be easier if you just post your whole main, we cant' continue guessing what you possibly do wrong.
Giovanni
It would be easier if you just post your whole main, we cant' continue guessing what you possibly do wrong.
Giovanni
Re: Ext driver example
Sorry, here you go, but be warned, that's just code to play arround with chibios, so much of trash arround there:
https://gist.github.com/2877114
(I am open for all kinds of improvements)
~ Tectu
https://gist.github.com/2877114
(I am open for all kinds of improvements)
~ Tectu
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Ext driver example
That code does not contain the code you posted before, I can't find that chEvtSignalFlagsI() anywhere, I am bit lost...
I can only recommend that you split the problems in smaller parts, make them all work separately and then put everything together.
Giovanni
I can only recommend that you split the problems in smaller parts, make them all work separately and then put everything together.
Giovanni
Re: Ext driver example
Okay, this was my bad, I am very sorry for that confusion. I stripped everything down now.
Now, let's play with open cards:
This works great: https://gist.github.com/2877845
It does just toggle the LED in the ISR, so no Thread wakeup stuff or something else.
This does not work anymore: https://gist.github.com/2877871
It lands in unhandled exception.
Sorry for the trouble with the changing/wrong code snippets
~ Tectu
Now, let's play with open cards:
This works great: https://gist.github.com/2877845
It does just toggle the LED in the ISR, so no Thread wakeup stuff or something else.
This does not work anymore: https://gist.github.com/2877871
It lands in unhandled exception.
Sorry for the trouble with the changing/wrong code snippets
~ Tectu
Re: Ext driver example
Is compiler not warn you on this line?
I can not see where you initialize Thread2 pointer. Function chThdCreateStatic() returns pointer that must be passed to signaling function. Signaller in your code tries to write somewhere "in space" and traps in unhandled exception.
Code: Select all
chEvtSignalFlagsI(Thread2, (eventmask_t)1);I can not see where you initialize Thread2 pointer. Function chThdCreateStatic() returns pointer that must be passed to signaling function. Signaller in your code tries to write somewhere "in space" and traps in unhandled exception.
Re: Ext driver example
okay, I really have to go this way now: I don't kow how to initialize that pointer the correct way? I read througth the wiki, but couldn't find something helping.
This article here http://chibios.org/dokuwiki/doku.php?id=chibios:howtos:wakeup#waking_up_a_specific_thread1 "does use another kind of threads". But I guess I can modify my code somehow to bring it to work?
Sorry for this nooby question, but I really don't have any clue.
~ Tectu
This article here http://chibios.org/dokuwiki/doku.php?id=chibios:howtos:wakeup#waking_up_a_specific_thread1 "does use another kind of threads". But I guess I can modify my code somehow to bring it to work?
Sorry for this nooby question, but I really don't have any clue.
~ Tectu
Re: Ext driver example
for example:
define pointer to some thread
init it:
now it points to Thread2
send event:
If it will not work than try to use semaphores instead of events, they are much easy to understand.
define pointer to some thread
Code: Select all
Thread *thread2_p = NULL;init it:
Code: Select all
thread2_p = chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);now it points to Thread2
send event:
Code: Select all
chEvtSignalFlagsI(thread2_p, (eventmask_t)1);If it will not work than try to use semaphores instead of events, they are much easy to understand.
Re: Ext driver example
Aaaah, Volia!
This works: https://gist.github.com/2880420
But now we get back to the problem we had before.
This dosen't work again: https://gist.github.com/2880389 (line 34)
As soon as I press the touchpad, the LED3 in does start blinking over and over again (It does not go to sleep anymore).
Not sure where the problem is here again. That was the same problem before I started waking up a thread.
As I said before, tpReadX() and tpReadY() do work great within any thread, which does not get controlled over the EXT driver.
any ideas?
~ Tectu
This works: https://gist.github.com/2880420
But now we get back to the problem we had before.
This dosen't work again: https://gist.github.com/2880389 (line 34)
As soon as I press the touchpad, the LED3 in does start blinking over and over again (It does not go to sleep anymore).
Not sure where the problem is here again. That was the same problem before I started waking up a thread.
As I said before, tpReadX() and tpReadY() do work great within any thread, which does not get controlled over the EXT driver.
any ideas?
~ Tectu