cancel
Showing results for 
Search instead for 
Did you mean: 

Wake up Example Question.

hans536
Associate III

I am currently reviewing examples of the phrase 'WKPU'.

Example is "SPC58xHxx_cut2_RLA WKPU Interrupt Test Application for Discovery".

If you press button sw0, LED3 turns on.

If you press button sw1, LED1 turns on.

And if you press button sw2, LED2 turns on.

What I'm curious about.

void wkpu0_int12_cb(WKPUDriver *wkpup);

I'm curious about how the function is linked to the sw1 button. Can you explain that?

Likewise....

void wkpu0_int18_cb(WKPUDriver *wkpup);

I'm curious about how the function is linked to the sw2 button. Can you explain that?

And..​

void wkpu0_int18_cb(WKPUDriver *wkpup);

I'm curious about how the function is linked to the sw3 button. Can you explain that?​

​In conclusion, it's all the same question....

​help me ㅠㅠ

1 ACCEPTED SOLUTION

Accepted Solutions
hans536
Associate III

I've solved this problem.

CGM_AC14_SC.SELCTRL of Clock tree change XOSC to IRCOSC.

​like attached file.

View solution in original post

9 REPLIES 9
ODOUV.1
ST Employee

Hi hasumi,

you deserve a better answer than the last one from chatGPT.

issue whit chatGPT is that answer seems coherent, but all details are false.

Please let me a little more time to answer to your one question:

"void wkpu0_int18_cb(WKPUDriver *wkpup);

I'm curious about how the function is linked to the sw button. Can you explain that?"

then you will extrapole for your smae last questions.

see you soon for the true answer and

Best Regards

ODOUV.1
ST Employee

Open the board User Manual UM2697:

 
_legacyfs_online_stmicro_images_0693W00000bhxduQAA.png 

You can see that push button 1 (PB1) is connected to MCU port PA2.

In SPC5Studio, open the Pinmap Wizard in your application:

 
_legacyfs_online_stmicro_images_0693W00000bhxdzQAA.png 

You can see that MCU port PA2 is configured as interrupt input WPKU0_INT18.

Open the Reference Manual RM0452 and look to table 51:

 
_legacyfs_online_stmicro_images_0693W00000bhxe9QAA.png 

You can see that WAKPU0 module interrupt WKUP18 is mapped on WKPU_0_IRQ_2.

Then look on table 37:

 
_legacyfs_online_stmicro_images_0693W00000bhxedQAA.png 

You can see that WKPU0 IRQ2 is mapped to MCU External Interrupt 249.

In our header spc58xh_registry.h :

#define SPC5_WKPU0_IRQ2_HANDLER            vector249

In our low level driver wkpu_lld.c :

IRQ_HANDLER(SPC5_WKPU0_IRQ2_HANDLER) {

WKPUD1.config->wk_config[i + 16U]->irq_cb(&WKPUD1);

}

When interrupt occurs, the driver WKPUD1 is calling the call-back irq_cb registered in wk_config.

This is why in our main function we configure WKPUD1:

 wkpu_lld_start(&WKPUD1, &wkpu_config_wkpu0);

wkpu_config_wkpu0. wk_config [18] is configured with wkpu_config_wkpu0_wk_INT18

and wkpu_config_wkpu0_wk_INT18.irq_cb is configured with call-back wkpu0_int18_cb which is defined in our demo main.c

Best Regards.

ODOUV.1
ST Employee

So according to the code, when pushing on Button1, You should toggle the LED2 mapped on MCU port PI[12]
_legacyfs_online_stmicro_images_0693W00000bhxg0QAA.pngso it is LD8, connected to JP44

This is not in line with demo README file...

Thank you for explaining the above problem so well that I understand it. Thank you.

One more question related to the wake up example!

It's about examples.-> "SPC58xHxx_cut2_RLA_WKPU Test Application for Discovery"

When I run the example, it worked successfully.

When the RUNMODE of SPC5 is set to STOP0 and the SW_1 button is pressed, the board successfully transitions back to RUN mode.

I created a project to replicate the same behavior, but the SW_1 button press did not transition the mode to RUN as expected..

Is there anything that needs to be configured to make the SW_1 button transition the mode to RUN?

I compared the example code with my project and made the necessary configurations. If there are any other areas I should check, please let me know....

Hello,

maybe you forgot to activate de wakeup request in Low Level Driver configuration ?


_legacyfs_online_stmicro_images_0693W00000biKQ5QAM.png 

Best Regard.

Unfortunately.. no;;;​

Anything else to check?

ODOUV.1
ST Employee

Humm not really unfortunately...

may be check you have this code in main .c:

void int18_irq_cb(WKPUDriver *wkpup)

{

 (void)wkpup;

 /* Wait the SIUL2 is ready after

   the exit from the SPOP0 mode.*/

 while (MC_ME.PS0.B.S_SIUL == 0U) {

  ;

 }

 pal_lld_setpad(PORT_I, PI_LED2);

}

this in main function:

 wkpu_lld_start(&WKPUD1, &wkpu_config_wkpu_cfg);

this in wkpu_lld_cfg.c:

WKPUConfig wkpu_config_wkpu_cfg = {

 {

  NULL,

  NULL,

  NULL,

  NULL

 },

 {

   NULL,//0

   NULL,//1

   NULL,//2

   NULL,//3

   NULL,//4

   NULL,//5

   NULL,//6

   NULL,//7

   NULL,//8

   NULL,//9

   NULL,//10

   NULL,//11

   NULL,//12

   NULL,//13

   NULL,//14

   NULL,//15

   NULL,//16

   NULL,//17

   &wkpu_config_wkpu_cfg_wk_INT18,//18

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

   NULL,

 }

};

and

WakeupConfig wkpu_config_wkpu_cfg_wk_INT18 = {

 TRUE,

 TRUE,

 int18_irq_cb,

 FALSE,

 TRUE,

 TRUE,

 FALSE

};

hans536
Associate III

Unfortunately....

I copied and pasted the code you provided, but it didn't work as expected. Thank you for your response.

hans536
Associate III

I've solved this problem.

CGM_AC14_SC.SELCTRL of Clock tree change XOSC to IRCOSC.

​like attached file.