Post Go back to editing

simple example on using UART interrupt to receive buffer from serial

Category: Software
Product Number: ADSP-BF592


i would appreciate help in writing a simple test code to read data from UART in interrupt mode.

I am a newbe here.

I started with CharECHO_UART example and i was able to connect a terminal emulator (using a USB-DB9 cable). Then using Tera Term i sent a file

to my board and in DMA mode i was able to read all bytes i received.

Then i try something like:

static ADI_UART_HANDLE hDevice;

static void UARTCallback(void* pHandle, uint32_t u32Arg, void* pArg) {

printf("UART CALLBACK!!!!\n");
uint16_t *data = (uint16_t*)pArg;

printf("complete buffer:%s\n", ReceiveBuffer);


here's the problem: my ReceiveBuffer contains only the last char sent from Termina Emulator



int32_t main(void) {

// open UART in bidirectional interrupt mode mode


adi_uart_SetBaudRate(hDevice, 115200u);


adi_uart_RegisterCallback(hDevice, UARTCallback, (void*)0);

adi_uart_SubmitRxBuffer(hDevice, ReceiveBuffer, 2);

adi_uart_EnableRx(hDevice, true);

while (true){

// do nothing



The problem is i only get the last character sent from terminal. I need to catch all chars sent from terminal

Each message sent from terminal may have different length so i need to process each received byte individually

I searched a lot and was not able to find a basic example that help me to build a simple program that read from UART in interrupt mode

  • Hi,

    We have sample code as per your requirement for BF707. Please refer FAQ from below path.

     [FAQ] : How to pass group of characters via UART 

    Please modify your code by using this as a reference. 

    You can refer detailed description of APIs from the below Help path
    CrossCore® Embedded Studio 2.x.x > System Run-Time Documentation > System Services and Device Drivers > ADSP-BF592 API Reference > Modules

    As well as you can refer driver implementation from the below installation path
    C:\Analog Devices\CrossCore Embedded Studio 2.x.x\Blackfin\lib\src\drivers\source\uart

    Hope this helps.

    Best regards,

  • Hi,

    thank you for your reply but i was not able to solve.

    The example shows how to write on UART from DSP. I need to read incoming bytes from UART and, in my case, i cannot assume that incoming data has a fixed length.

    In some way i should be "listening" for any incoming byte and process manually to understand if the message is complete.

    Maybe i am wrong, but i was thinking that an interrupt may be raised for any incoming byte (or any other mechanism)

    I spent some day on reading both documentation and drivers implementation with no luck


  • Little progress. I was able to to use UART in interrupt mode polling in a loop

    with adi_uart_IsRxBufferAvailable(hDevice, &bufferAvailable);

    now happens that a printf seems to write on serial output

    instead of writing into console

Reply Children
No Data