AnsweredAssumed Answered

BF514 UART DMA Transmit using Drivers library

Question asked by Quintinvw on Feb 12, 2016
Latest reply on Apr 1, 2016 by PrasanthR

Hi,

 

Im using the drivers library in my project. I have a problem with the UART DMA Transmit side of things.

 

I want to initialize the driver as is recommended by various examples and also by the documentation. See below.

 

     // UART0  Give driver the inbound buffer

      Result = adi_dev_Read(U0DriverHandle, ADI_DEV_1D, (ADI_DEV_BUFFER *) &U0InboundBuffer);

      if(Result != ADI_DEV_RESULT_SUCCESS)

      {

        return (FAIL);

      }

 

      // UART0  Give driver the outbound buffer

      Result = adi_dev_Write(U0DriverHandle, ADI_DEV_1D, (ADI_DEV_BUFFER *) &U0OutboundBuffer);

      if(Result != ADI_DEV_RESULT_SUCCESS)

      {

        return (FAIL);

      }

 

      // UART0 Enable Data Flow

      Result = adi_dev_Control(U0DriverHandle, ADI_DEV_CMD_SET_DATAFLOW, (void *) TRUE);

      if(Result != ADI_DEV_RESULT_SUCCESS)

      {

        return (FAIL);

      }

 

The UART DMA transmit works. Only problem I currently have is the moment I call the last function, adi_dev_Control() to enable data flow, the UART sends of one byte. Obviously this is the byte of data I have initiales the U0OutboundBuffer with. I dont want this one byte of data to be transmitted. If I dont initialize the driver this way, my code gets stuck in the interrupt section (adi_int.asm or adi_dma.c etc.).

 

I want to send data over later in my application but have found that if I do not call the adi_dev_write() function as above before adi_dev_control(), my application does not run correct. I have tried setting the U0OutboundBuffer up with a element count = 0, but then the UART DMA blasts of a few hundred bytes of junk data at startup and only after that continues to send my 50ms interval packets.

 

I just want to initialise the driver without it sending that byte of data off at startup. Is it possible or will I have to make do with it like that and just the connected processor to ignore that one byte? I need the rx buffer initialized at startup so I cant wait until I have something to send to call the adi_dev_control function to enable data flow. It must always be ready to send data and always be ready to receive.

 

The examples using the UART driver are always the same, setup the tx buffer and rx buffer before calling adi_dev_control fucntion and then the DMA sends and receives the data as soon as control is called and voila, finished. Theres no example setting the UART DMA up with the driver. And then maybe pushing a button will send the data off and receive it.

 

Please let me know if you need more information. Prashant HBM

Andreas

 

Kind regards,

Quintin.

Outcomes