AnsweredAssumed Answered

OnBlockSent Event functions still returning BUSY?

Question asked by Joshua Einstein on Dec 18, 2012
Latest reply on Jan 2, 2013 by Petr_H

We have code for a circular buffer that we're using for printf, and we were hoping to make it interrupt driven. What I noticed is that the PE Serial functions (and other functions that use the SendBlock methods) don't look to reset their state until after going through the interrupt a second time.

 

For UART modules, what this means is that calling <device>_SendBlock while within the interrupt will still return ERR_BUSY even though the block has already been sent.

 

To make our own version of an interrupt driven buffer, does PE have any way of working, or would we need to rewrite the PE code to enable us to use UART interrupts directly?

 

Relevant code:

 

static void InterruptTx(AS1_TDeviceDataPtr DeviceDataPrv)

{

  if (DeviceDataPrv->OutSentDataNum < DeviceDataPrv->OutDataNumReq) { /* Is number of sent characters less than the number of requested incoming characters? */

    UART_PDD_PutChar8(UART3_BASE_PTR, *(DeviceDataPrv->OutDataPtr++)); /* Put a 8-bit character to the transmit register */

    DeviceDataPrv->OutSentDataNum++;   /* Increment the counter of sent characters. */

    if (DeviceDataPrv->OutSentDataNum == DeviceDataPrv->OutDataNumReq) {

      AS1_OnBlockSent(DeviceDataPrv->UserDataPtr);

    }

  } else {

    UART_PDD_DisableInterrupt(UART3_BASE_PTR, UART_PDD_INTERRUPT_TRANSMITTER); /* Disable TX interrupt */

    DeviceDataPrv->SerFlag &= (uint16_t)(~(uint16_t)ENABLED_TX_INT); /* Clear the flag ENABLED_TX_INT */

    DeviceDataPrv->OutDataNumReq = 0x00U; /* Clear the counter of characters to be send by SendBlock() */

  }

}

 

You can see how the OnBlockSent code won't reset until OutDataNumReq resets. Any thoughts?

 

Outcomes