little help with ADS7843

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: little help with ADS7843

Post by daviddawe1982 »

Ok Techu I will try as soon as I get home, one difference I did notice is I am creating the thread this way
chThdCreateFromHeap
And you are using this
chThdCreateStatic
This may be my problem..
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: little help with ADS7843

Post by Tectu »

If you create a thread using chThdCreateFromHeap() you have to make sure that you have enough memory since it will be allocated dynamically. This routine should only be used when you create threads while run time. Threads, like yours, where you know that you will need it should be created using the chThdCreateStatic routine.


~ Tectu
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: little help with ADS7843

Post by daviddawe1982 »

Ok Techu,
Your code worked fine, So I went back to my code and started to remove certain things and I have found the course of my problems..
sprintf
I use it twice in one thread and without them all of my code works fine including the buttons that toggle a led!
Is there a alternative to sprintf for drawing a ADC result??
Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm

Re: little help with ADS7843

Post by Abhishek »

Use chprintf, with a GWinConsole.

You can find a guide here: http://www.chibios-gfx.com/documentation/gwin/console .
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: little help with ADS7843

Post by Tectu »

What Abhishek said is totally accurate and might be the best solution for you.


~ Tectu
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: little help with ADS7843

Post by daviddawe1982 »

Well I tried chprintf and it did the same thing, The working area of the thread calling it is sill 1024.
Are the print commands resource hungry?
I also tried to chprintf to console in Main thread and it also stops the code..
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: little help with ADS7843

Post by Tectu »

Please read this documentation explaining how to debug stack issues. I might have a look at your code tonight.
Just set the stack size higher and see yourself. Also check your optimization flags.


~ Tectu
Locked