uart driver usage problem:: After receiving callback function is set, Uart_AsyncSend () cannot use

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

uart driver usage problem:: After receiving callback function is set, Uart_AsyncSend () cannot use

766件の閲覧回数
jianqun
Contributor II

RTD版本:S32G 4.0  开发板 RDB3

1.init

 

uint32 varRemainingBytes;
volatile Uart_StatusType Uart_Status;
volatile Std_ReturnType Std_Uart_Status;
uint8 Tx_Buffer[MSG_LEN];
memset(Rx_Buffer, 0 , MSG_LEN);
memset(Tx_Buffer, 0 , MSG_LEN);
/* Initializes an UART driver*/
Uart_Init(&Uart_xConfig_VS_0);
/* Uart_AsyncSend transmit data */
(void)Uart_AsyncSend(UART_CHANNEL, (const uint8 *)WELCOME_MSG, strlen(WELCOME_MSG));
/* Wait for Uart successfully send data */
while(Uart_GetStatus(UART_CHANNEL, &varRemainingBytes, UART_SEND) == UART_STATUS_OPERATION_ONGOING);
// (void)Uart_AsyncReceive(UART_CHANNEL, Rx_Buffer, strlen(EXPECT_RX_MSG));
//(void)Uart_AsyncReceive(UART_CHANNEL, &Rx_int_Buffer, 1);
        /* Wait for transfer to be completed */
// while(Rx_int_len<6);

 

2. callback

 

void Linflexd_Uart_Callback(uint8 Channel, Uart_EventType Event)
{
        switch(Event)
        {
                case LINFLEXD_UART_IP_EVENT_RX_FULL:// Rx buffer is full.
                Rx_Buffer[Rx_int_len] = Rx_int_Buffer;
                 Uart_SetBuffer(Channel,  &Rx_int_Buffer, 1, UART_RECEIVE);
                Rx_int_len++;
                break;
                case LINFLEXD_UART_IP_EVENT_TX_EMPTY: //Tx buffer is empty.

                break;
                case LINFLEXD_UART_IP_EVENT_END_TRANSFER: //The current transfer is ending.

                break;
                case LINFLEXD_UART_IP_EVENT_ERROR: //An error occured during transfer.
                Uart_AsyncReceive(UART_CHANNEL, &Rx_int_Buffer, 1);
                break;
                default:
                break;
        }
}

 

3. Let's say I call 

Uart_AsyncReceive(UART_CHANNEL, Rx_Buffer, 1);

I want to call setbuff inside the interrupt callback function after receiving bytes one by one to set to continue receiving,However, the UART SEND will fail

4.The reason is that the Uart_AsyncSend function has a check to see if receive is running

if ((UART_STATUS_OPERATION_ONGOING == ReceiveStatus) || \
(UART_STATUS_OPERATION_ONGOING == TransmitStatus))

 

static Std_ReturnType Uart_StartAsyncSend(uint8 CoreId, uint8 Channel, const uint8* Buffer, uint32 BufferSize)
{
    Std_ReturnType TempReturn = E_NOT_OK;
    Uart_StatusType ReceiveStatus;
    Uart_StatusType TransmitStatus;

    #if (UART_MULTICORE_SUPPORT == STD_ON)
    if (CoreId != Uart_apConfig[CoreId]->PartitionCoreId)
    {
        #if (UART_DEV_ERROR_DETECT == STD_ON)
        /* Invalid CoreId */
        (void)Det_ReportError((uint16)UART_MODULE_ID,
                              (uint8)0,
                              (uint8)UART_ASYNCSEND_ID,
                              (uint8)UART_E_PARAM_CONFIG);
        #endif /* (UART_DEV_ERROR_DETECT == STD_ON) */
    }
    else
    {
        if (NULL_PTR == Uart_apConfig[CoreId]->Configs[Channel])
        {
            #if (UART_DEV_ERROR_DETECT == STD_ON)
            (void)Det_ReportError((uint16)UART_MODULE_ID,
                                  (uint8)0,
                                  (uint8)UART_ASYNCSEND_ID,
                                  (uint8)UART_E_INVALID_CHANNEL);
            #endif /* (UART_DEV_ERROR_DETECT     == STD_ON) */
        }
        else
        {
    #endif /* (UART_MULTICORE_SUPPORT == STD_ON) */
            ReceiveStatus = Uart_Ipw_GetReceiveStatus(Channel, NULL_PTR);
            TransmitStatus = Uart_Ipw_GetTransmitStatus(Channel, NULL_PTR);
            if ((UART_STATUS_OPERATION_ONGOING == ReceiveStatus) || \
                (UART_STATUS_OPERATION_ONGOING == TransmitStatus))
            {
                #if (UART_DEV_ERROR_DETECT == STD_ON)
                (void)Det_ReportError((uint16)UART_MODULE_ID,
                                      (uint8)0,
                                      (uint8)UART_ASYNCSEND_ID,
                                      (uint8)UART_E_CHANNEL_BUSY);
                #endif /* (UART_DEV_ERROR_DETECT == STD_ON) */
            }
            else
            {
                TempReturn = Uart_Ipw_AsyncSend(Channel,
                                                Buffer,
                                                BufferSize);
                (void)CoreId;
            }
    #if (UART_MULTICORE_SUPPORT == STD_ON)
        }
    }
    #endif /* (UART_MULTICORE_SUPPORT == STD_ON) */
    return TempReturn;

 

So this is my use of the wrong or the driver problem, because the previous call IP driver is supported by this way, but the use of MCAL interface has this limitation

 

 

0 件の賞賛
返信
3 返答(返信)

749件の閲覧回数
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Thanks for the notice. We understand that this is a bug under the RTD, which should have been patched under RTD 4.0.x. We are using RTD 4.0.1 and see the same as you. We will verify the status of this bug and come back when we have an update. We apologize for this.

Please, let us know.

0 件の賞賛
返信

729件の閲覧回数
jianqun
Contributor II

I would like to ask you a question. My current RTD version is 4.0.0. If I upgrade to 4.01 or 4.0x later, do I need to redo the EB project of 4.0 now? Is there any documentation for version upgrade in this section

0 件の賞賛
返信

721件の閲覧回数
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

We can provide feedback on what we have to do under S32DS, which is to remake the project. As for EB Tresos, we may not be the correct support line. We can recommend contacting Elektrobit Support Team for them to provide you with a better answer. We do apologize.

As for the bug, we have received the following update:

"

Has been fixed in RTD4.0.2.

"

Please, let us know.

0 件の賞賛
返信