1

How do i disable the interrupt in this ARM M0 univesity design start program? The design is made for the M0 and echos an inputted char as an integer, it is part of a larger piece of code (which is ommitted for simplicity) Can i do it in the main program(attached) or will i have to edit the assembler code(also attached)?

  //------------------------------------------------------------------------------
// Cortex-M0 DesignStart C program example
//------------------------------------------------------------------------------

#include <stdio.h>
#include <time.h>
#include <rt_misc.h>
#include <stdlib.h>

#define AHB_LED_BASE                0x50000000
#define AHB_UART_BASE               0x51000000


void UART_ISR(void)
{
            int sample;
            char ch [16];
            sample = atoi (ch);
            printf("the value entered is %d\n", sample);
}

//////////////////////////////////////////////////////////////////
// Main Function
//////////////////////////////////////////////////////////////////

int main() 
    {

        char ch [16];
        while(1==1)
        {
        fgets (ch, 16, stdin);
    //printf("String: %s\n\n",ch);
        }
}

Assembly code

UART_Handler    PROC
                EXPORT UART_Handler
                IMPORT UART_ISR
                PUSH    {R0,R1,R2,LR}
                LDR     R1, =0x51000000               ;UART
                LDR     R0, [R1]                      ;Get Data from UART
                STR     R0, [R1]                      ;Write to UART

                BL UART_ISR

                POP     {R0,R1,R2,PC}
                ENDP


                ALIGN 4
1
  • What research have you done in finding 'How to disable interrupts?'. Can you supply a reference manual and/or other source that you have looked at? Commented May 6, 2014 at 17:32

2 Answers 2

2

If you use CMSIS drivers, check for:

  1. void __disable_irq(void)
  2. void __enable_irq(void)

They just call CPSIE and CPSID instructions.

Generally read about NVIC in the programming manual. I also recommend a fantastic book on Cortex M0:

The Definitive Guide to the ARM Cortex-M0 by Joseph Yiu.

Sign up to request clarification or add additional context in comments.

Comments

0

If u wish to write a simple code in ASM, you can simply store and raise the BASEPRI to a higher priority than all the NVIC's (besides, say, exception type debugMon), do what u need todo and than restore the original BASEPRI

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.