ADuCM350 UART interrupt

i am using ADuCM350EBZ evaluation board,i want to enable UART interrupt, like when i enter any button from keyboard then interrupt will occur. i am using one example given in this board here uart is already initialized like this

/* Open UART in blocking, non-intrrpt mode by supplying no internal buffs */
    if (ADI_UART_SUCCESS != (result = adi_UART_Init(ADI_UART_DEVID_0, &hUartDevice, NULL)))
    {
        return result;
    }

    /* Set UART baud rate to 115200 */
    if (ADI_UART_SUCCESS != (result = adi_UART_SetBaudRate(hUartDevice, ADI_UART_BAUD_115200)))
    {
        return result;
    }

    /* Enable UART */
    if (ADI_UART_SUCCESS != (result = adi_UART_Enable(hUartDevice,true)))
    {
        return result;
    }

    return result;
}
i do not want to change my baud rate how can i enable the UART interrupt i am also uploading my UART.c and UART.h file respectively that will help you for understanding
https://1drv.ms/u/s!AtrfhdPd0_93ae6sp-s1v5KggsI

https://1drv.ms/u/s!AtrfhdPd0_93as57exTFS20reWA
Please guide me how can i enable UART interrupt i will be very thankful to you.
Parents Reply Children
  • Thanks mark for kind reply. With your help now i am getting rx buffer full interrupt, But as you know in uart.c file where this interrupt is happening  there is a while loop i have define one function in this loop like this.

      while(1)
    {
    Handler() ;
    return;
    }

    And the Handler function is this (i have define this function in main code)

    void Handler()

    {

    if(RxBuffer[0] == 0x39)
    {

    /* AFE Power Down */
    if (adi_AFE_PowerDown(hDevice))
    {
    FAIL("adi_AFE_PowerDown");
    }

    /* Uninitialize the AFE API */
    if (adi_AFE_UnInit(hDevice))
    {
    FAIL("adi_AFE_UnInit");
    }

    /* Uninitialize the UART */
    adi_UART_UnInit(hUartDevice);

    PASS();
    }
    else
    {
    return;
    }

    My receive buffer size is 2 so i enter any number ending with 9 that will power down my system and it's working. But when i enter any 2 number (Not ending with 9) it has been stopping my program and i need to press Run button again. 

    how can i fix this problem. 

  • 0
    •  Analog Employees 
    on Feb 26, 2019 7:13 AM in reply to aitzaz

    Hi,

    I won't recommend editing uart.c file, this is considered as a library file and any change to this can affect other example codes. 

     In the Uart_CharEcho.c, there is a while loop where you can add all these functions. You can also access RxBuffer inside this which you can use for your commands.

    while(bStopFlag == false)
    {
    rxSize = 1;
    txSize = 1;

    /* Read a character */
    uartResult = adi_UART_BufRx(hDevice, RxBuffer, &rxSize);
    if (ADI_UART_SUCCESS != uartResult)
    {
    test_Fail("adi_UART_BufRx() failed");
    }

    /* copy receive character to transmit */
    TxBuffer[0] = RxBuffer[0];

    ...

    -Mark

  • Hi @mark.ramos could you tell me what version of the SDK is this example in? I have an older SDK and I haven't seen this example in there.