Echo of data in UART through interrupts in LM3S811 Qemu Simulation

0

I am trying to transmit and receive characters in UART through interrupts in LM3S811 using Qemu Simulation. I wrote this code with the help of this https://www.electronicwings.com/arm7/lpc2148-uart0. I am not sure whether it is correct and it does not work. Could someone suggest how to get the task done.

startup code :

.thumb
.global start
start:
.word 0x20001000
.word main

flash.ld

MEMORY
{
    FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000
    SRAM (rxw)  : ORIGIN = 0x20000000, LENGTH = 0x00002000
}

SECTIONS
{
    .text : {
        *(.vectors);
        *(.text);
        etext = .;
    } > FLASH

    .rodata : {
        *(.rodata);
    } > FLASH

    .data : {
        sdata = .;
        *(.data);
        edata = .;
    } > SRAM AT > FLASH

    .bss: {
        sbss = .;
        *(.bss);
        ebss = .;
    }  > SRAM
    
}

main.c

#define  UARTDR (*((volatile unsigned int *) 0x4000C000))  // Data register for UART...
#define UARTIFLS (*((volatile unsigned int *) 0x40000034)) // Interrupt identification register...
#define  UARTFR (*((volatile unsigned int *) 0x4000C018))  // Register which holds the status of the FIFO...
char rx;

_irq void UART0_Inerrupt(void)
{
    int iir_value;
    iir_value = UARTIFLS  // Interrupt Identification register...

    if (iir_value & 0x00) {  // If interrupt is received, i.e data is present... 
        rx = UARTDR; 
    }
    UARTDR = rx; // Write to data register for writing to transmit FIFO...
    while ( (UARTFR & 0x20) == 1) continue; 
}

int main(void)
{
    NVICVectAddr0 = (unsigned) UART0_Inerrupt;
    while(1);
}
``
arm
microcontroller
cortex-m
microprocessors
cortex-m3
asked on Stack Overflow Jul 28, 2020 by Paulson Raja L

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0