AnsweredAssumed Answered

Uart write and read Problem

Question asked by barreh.walid.EBSYS on Oct 23, 2012
Latest reply on Oct 31, 2012 by jobo23

Hi

I tried to integrate the uart driver with Video decoder & encoder driver, but uart write function is not working .

 

We used the following code:

 

 

void main(void)

{

/* Initialize ADI components */

    adi_initComponents();

 

 

    /* Configure software switches on ADSP-BF609 EZ-Board */

     ConfigSoftSwitches_BF609();

 

 

    /* Configure system - terminate configuration process on error */

    do

    {

        /* Initialize OSAL */

        if (adi_osal_Init() != ADI_OSAL_SUCCESS)

        {

            DEBUG_MSG1("Failed to Initialize OSAL\n");

            Result = FAILURE;

                   break;

        }

 

 

        /* Initialize Power service */

            if(adi_pwr_Init(CLKIN, CORE_MAX, SYSCLK_MAX, VCO_MIN) != ADI_PWR_SUCCESS)

            {

                REPORT_ERROR("Failed to initialize power service \n");

                return FAILED;

            }

 

 

        /* Initialize GPIO service with number of callbacks required */

        if(adi_gpio_Init(GPIOCallbackMem, GPIO_MEM_SIZE, &NumCallbacks) != ADI_GPIO_SUCCESS)

        {

            DEBUG_MSG1 ("Failed to configure GPIO Service\n");

            Result = FAILURE;

                  break;

        }

/* Initialize ADV7511 Encoder */

               Result = (uint32_t) InitEncAdv7511();

        if (Result)

        {

            DEBUG_MSG2("Failed to initialize ADV7511 video encoder", Result);

            break;

               }

  /* Initialize ADV7842 Decoder */

        Result = (uint32_t) InitDecAdv7842();

        if (Result)

        {

            DEBUG_MSG2("Failed to initialize ADV7842 video decoder", Result);

                   break;

               }

/*

         * Initialize UART

         */

        /* Open UART driver */

        if((eResult = adi_uart_Open(UART_DEVICE_NUM,

                                     ADI_UART_DIR_BIDIRECTION,

                                     gUARTMemory,

                                     ADI_UART_BIDIR_DMA_MEMORY_SIZE,

                                     &ghUART)) != ADI_UART_SUCCESS)

        {

                  REPORT_ERROR("Could not open UART Device 0x%08X \n", eResult);

                  //return FAILED;

                  break;

        }

        /* Set the UART Mode */

        if((eResult = adi_uart_SetMode(ghUART,

                                        ADI_UART_MODE_UART

                                       )) != ADI_UART_SUCCESS)

        {

                  REPORT_ERROR("Could not set the Mode 0x%08X \n", eResult);

                  //return FAILED;

                  break;

        }

 

 

        /* Set UART Baud Rate */

        if((eResult = adi_uart_SetBaudRate(ghUART,

                                                                                                  BAUD_RATE

                                            )) != ADI_UART_SUCCESS)

        {

                  REPORT_ERROR("Could not set the Baud Rate 0x%08X \n", eResult);

                  //return FAILED;

                  break;

        }

 

 

        /* Set number of stop bits */

        if((eResult = adi_uart_SetNumStopBits(ghUART,

                                                ADI_UART_ONE_STOPBIT

                                             )) != ADI_UART_SUCCESS)

        {

                  REPORT_ERROR("Could not set the stop bits 0x%08X \n", eResult);

                  //return FAILED;

                  break;

        }

 

        /* Set number of stop bits */

        if((eResult = adi_uart_SetWordLen(ghUART,

                                              ADI_UART_WORDLEN_8BITS

                                             )) != ADI_UART_SUCCESS)

        {

                  REPORT_ERROR("Could not set word length 0x%08X \n", eResult);

                  //return FAILED;

                  break;

        }

 

       while(1){

            RxBuffer[0] = '0';

                      RxBuffer[1] = '1';

                      RxBuffer[2] = '3';

 

 

           if((eResult = adi_uart_Write(ghUART,&RxBuffer[0],/*nTxSize*/3)) != ADI_UART_SUCCESS)

           {

                            REPORT_ERROR("Error  0x%08X \n", eResult);

                            //return FAILED;

                            break;

                  }

        }

}

 

THANKS...

Outcomes