chThdSuspendS problem

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

MySOL93
Posts: 5
Joined: Thu Dec 29, 2016 9:06 pm
Has thanked: 2 times

chThdSuspendS problem

Postby MySOL93 » Mon May 15, 2017 11:48 am

Hello! Need some help with "Suspend/Wakeup"

Code: Select all


static thread_reference_t* PWaitingThread;

/*
 * Threads
 */

static THD_WORKING_AREA(waThd,512);
static THD_FUNCTION(Thd, arg){
   

   //chSysLock();
     chThdSuspendS(PWaitingThread);
   //chSysUnlock();
   
   while(TRUE) {
      
   
   
   palSetPad(GPIOB, GPIOB_LED4);
   chThdSleepMilliseconds(MS2ST(100));
   palClearPad(GPIOB, GPIOB_LED4);
   chThdSleepMilliseconds(MS2ST(100));
      
   }
}

int main(void) {




    halInit();
     chSysInit();

   
   chThdCreateStatic(waThd, sizeof(waThd), NORMALPRIO+5, Thd, NULL);

   
   while (true) {
   
      chThdSleepMilliseconds(MS2ST(500));
      chSysLockFromISR();
         thread_t *tp= *PWaitingThread;
              chSchReadyI(tp);
      chSysUnlockFromISR();
  }
}


SV#8 error on "chThdSuspendS(PWaitingThread);" in thread. I would be grateful for any help.
Thank you!

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: chThdSuspendS problem

Postby Giovanni » Mon May 15, 2017 1:29 pm

Hi,

S-class functions must be called between a chSysLock() and chSysUnlock(), the state checker is informing you that something is wrong there.

Giovanni

MySOL93
Posts: 5
Joined: Thu Dec 29, 2016 9:06 pm
Has thanked: 2 times

Re: chThdSuspendS problem

Postby MySOL93 » Mon May 15, 2017 4:24 pm

Giovanni wrote:Hi,

S-class functions must be called between a chSysLock() and chSysUnlock(), the state checker is informing you that something is wrong there.

Giovanni


Thank for answer!
I am uncomment "chSysLock()" and "chSysUnlock()" and now i got SV#4

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: chThdSuspendS problem

Postby Giovanni » Mon May 15, 2017 6:04 pm

The meaning of codes is in this article: http://www.chibios.org/dokuwiki/doku.ph ... ebug_guide

Giovanni

MySOL93
Posts: 5
Joined: Thu Dec 29, 2016 9:06 pm
Has thanked: 2 times

Re: chThdSuspendS problem

Postby MySOL93 » Mon May 15, 2017 8:32 pm

Giovanni wrote:The meaning of codes is in this article: http://www.chibios.org/dokuwiki/doku.ph ... ebug_guide

Giovanni


Giovanni, thank you for your help


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 20 guests