cancel
Showing results for 
Search instead for 
Did you mean: 

Start using SPC

ssk
Associate II
Posted on January 23, 2015 at 14:21

Hello All,

I am new user for SPC series MCU and SPC5Studio as well. I am trying to start with few example codes to understand the HAL, PAL implementations. I am trying to go through different posts on this forum to understand the way people are accessing the features. But somehow I am find it very very difficult to locate the resources - be it a sample code or a file reference or even a document reference. E.g A post below mentions about document sections,

You can use External INTERRUPT In SIUL

chapter 48

and the convenient EIRQ[X]

chapter 48.4

you should use vector41 , vector42, vector 43 or vector 44

41 0x0290 16 SIU External IRQ_0 SIUL

42 0x02A0 16 SIU External IRQ_1 SIUL

43 0x02B0 16 SIU External IRQ_2 SIUL

44 0x02C0 16 SIU External IRQ_3 SIUL

2) for mapping you should use IO Settings and set your good port/function in the good mode

   

chap 4

from the convenient table ''function summary''

I tried referring to the reference manual for SPC560 series (RefManual_CD00259063.pdf) to locate these sections but could not find. Is there any other document/manual that mentions all this information? I tried searching SPC5Studio help as well.

I beg your pardon for asking such simple questions through different posts but if you can provide the details, it will help me move further. Thanks for all your help.

Mike.
3 REPLIES 3
Erwan YVIN
ST Employee
Posted on January 27, 2015 at 10:38

Hello Mike ,

I have put an example

SPC560Dxx OS-Less EIRQ Test Application for Discovery in attachment

When you click on the button , EIRQ #0 is detected (Rising event) and toggle the LED_7

if you want to use EIRQ 0 :

1) Set by the Pinmap Wizard EIRQ #0 as

DIGITAL INPUT

2) Define your vector41 handler (cf table123 for SPC56DXX)

everytime , you have to read the status bits and clear the read status bits 😉

/* with a wire : plug the PA[11] (BUTTON) with PA[3] (IRQ #0) */
#define BUTTON1 vector41
OSAL_IRQ_HANDLER(BUTTON1){
uint32_t sr0;
OSAL_IRQ_PROLOGUE();
/* Reading status bits.*/
sr0 = SIU.ISR.R;
/* Clearing read status bits.*/
SIU.ISR.R = sr0;
palTogglePad(PORT_C,PC_LED7); 
//LED is connected to +3,3V
OSAL_IRQ_EPILOGUE();
}

3) in main :

2 events possible Rising or Falling

/* Interrupts are enabled and the system is ready.*/
osalIsrEnable();
/* Enable Vector Interruption SIU External IRQ_0 */
/* Cf Table 123 */
osalIsrEnableVector(41,7);
/* Activate Rising Edge Events */
SIU.IREER.B.IREE0=1;
/* Enable EIRQ #0 */
SIU.IRER.B.IRE0=1;

Your application is READY to use EIRQ #0;-)

Best regards

Erwan

________________

Attachments :

SPC560Dxx_OS-Less_EIRQ_Test_Application_for_Discovery.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006qVT2&d=%2Fa%2F0X0000000bnw%2Fh8UWHTn78RGZHKkbeZcPgL90viNti8bHReTEMhh7CFY&asPdf=false
ssk
Associate II
Posted on January 28, 2015 at 15:00

Thanks for the example for ext interrupt. I tried understanding the int handler from few posts on this forum.

It would be great help if you can provide the details for the documents highlighted

yellow

in below para. Is it reference manual for SPC560 series (CD00259063.pdf)? 

This para is from one of the posts - ''Problem with external interrupt''

You can use External INTERRUPT In SIUL

 chapter 48

and the convenient EIRQ[X] 

chapter 48.4

2) for mapping you should use IO Settings and set your good port/function in the good mode

    

chap 4

 from the convenient table ''function summary''

Thanks in advance.

Mike.
Erwan YVIN
ST Employee
Posted on January 30, 2015 at 11:18

Hello Mike ,

The RM for CD00259063.

Useful chapter is 17.6

Same Vector IRQ Number used (41,42,43)

and the chapter 23.6.3 for a full description of External Interrupt Controller

EIRQ0-EIRQ23

      Best Regards

                  Erwan