LPUART_RS485

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

LPUART_RS485

2,738件の閲覧回数
intern_praveena
Contributor II

I am doing uart tx and rx using RS485,In that i can able to tx and rx but in putty entering char is not displayed.What is the problem??like if i press 'a' its receiving in debug session , but it not dispalyed in putty.

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

2,345件の閲覧回数
intern_praveena
Contributor II

thanks , but if i use LPUART_RECVE function in driver code then only receiving data is working . if i remove that function in driver code only in main function its not working.

0 件の賞賛
返信

2,345件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

what is the SDK version you use? I would strongly recommend to use the latest one.

BR, Petr

0 件の賞賛
返信

2,345件の閲覧回数
intern_praveena
Contributor II

I m using S32SDK_S32K14x_EAR_0.8.6 (S32K144_64)

0 件の賞賛
返信

2,345件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you need to enable local echo within terminal tool or you should send receive byte back to display it on terminal window.

Regarding LPUART_DRV_IRQHandler; seems you are using some older SDk version as in the latest SDK RTM 3.0.0 the LPUART_DRV_ReceiveData is not called from interrupt.

BR, Petr

0 件の賞賛
返信

2,345件の閲覧回数
intern_praveena
Contributor II

why LPUART_RECEIVE function is also used in driver code,what is the reason???

void LPUART_DRV_IRQHandler(uint32_t instance)
{
DEV_ASSERT(instance < LPUART_INSTANCE_COUNT);

lpuart_state_t * lpuartState = (lpuart_state_t *)s_lpuartStatePtr[instance];
LPUART_Type * base = s_lpuartBase[instance];

/* Exit the ISR if no transfer is happening for this instance. */
if (!lpuartState->isTxBusy)
{
if (!lpuartState->isRxBusy)
{
return;
}
}

/* Handle receive data full interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_RX_DATA_REG_FULL))
{
if (LPUART_GetStatusFlag(base, LPUART_RX_DATA_REG_FULL))
{
/* Invoke callback if there is one */
if (lpuartState->rxCallback != NULL)
{
lpuartState->rxCallback(lpuartState, UART_EVENT_RX_FULL, lpuartState->rxCallbackParam);
}
else
{
/* Get data and put in receive buffer */
LPUART_DRV_GetData(instance);

/* Update the internal state */
if (lpuartState->bitCountPerChar == LPUART_8_BITS_PER_CHAR)
{
++lpuartState->rxBuff;
--lpuartState->rxSize;
}
else
{
++lpuartState->rxBuff;
++lpuartState->rxBuff;
lpuartState->rxSize -= 2U;
}

/* Finish reception if this was the last byte received */
if (lpuartState->rxSize == 0U)
{
/* Complete transfer, will disable rx interrupt */
LPUART_DRV_CompleteReceiveDataUsingInt(instance);
LPUART_DRV_ReceiveData(1,&rxbuff,1);

}
}
}
}

/* Handle transmitter data register empty interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_TX_DATA_REG_EMPTY))
{
if (LPUART_GetStatusFlag(base, LPUART_TX_DATA_REG_EMPTY))
{
/* Check if there are any more bytes to send */
if (lpuartState->txSize > 0U)
{
/* Invoke callback if there is one */
if (lpuartState->txCallback != NULL)
{
lpuartState->txCallback(lpuartState, UART_EVENT_TX_EMPTY, lpuartState->txCallbackParam);
}
else
{
/* Transmit the data */
LPUART_DRV_PutData(instance);

/* Update the internal state */
if (lpuartState->bitCountPerChar == LPUART_8_BITS_PER_CHAR)
{
++lpuartState->txBuff;
--lpuartState->txSize;
}
else
{
++lpuartState->txBuff;
++lpuartState->txBuff;
lpuartState->txSize -= 2U;
}

/* Finish the transmission if this was the last byte */
if (lpuartState->txSize == 0U)
{
/* Complete transfer, will disable tx interrupt */
LPUART_DRV_CompleteSendDataUsingInt(instance);
}
}
}
}
}

/* Handle receive overrun interrupt */
if (LPUART_GetStatusFlag(base, LPUART_RX_OVERRUN))
{
lpuartState->receiveStatus = STATUS_UART_RX_OVERRUN;
/* Clear the flag, OR the rxDataRegFull will not be set any more */
(void)LPUART_ClearStatusFlag(base, LPUART_RX_OVERRUN);
}
}

void LPUART_DRV_IRQHandler(uint32_t instance)
{
DEV_ASSERT(instance < LPUART_INSTANCE_COUNT);

lpuart_state_t * lpuartState = (lpuart_state_t *)s_lpuartStatePtr[instance];
LPUART_Type * base = s_lpuartBase[instance];

/* Exit the ISR if no transfer is happening for this instance. */
if (!lpuartState->isTxBusy)
{
if (!lpuartState->isRxBusy)
{
return;
}
}

/* Handle receive data full interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_RX_DATA_REG_FULL))
{
if (LPUART_GetStatusFlag(base, LPUART_RX_DATA_REG_FULL))
{
/* Invoke callback if there is one */
if (lpuartState->rxCallback != NULL)
{
lpuartState->rxCallback(lpuartState, UART_EVENT_RX_FULL, lpuartState->rxCallbackParam);
}
else
{
/* Get data and put in receive buffer */
LPUART_DRV_GetData(instance);

/* Update the internal state */
if (lpuartState->bitCountPerChar == LPUART_8_BITS_PER_CHAR)
{
++lpuartState->rxBuff;
--lpuartState->rxSize;
}
else
{
++lpuartState->rxBuff;
++lpuartState->rxBuff;
lpuartState->rxSize -= 2U;
}

/* Finish reception if this was the last byte received */
if (lpuartState->rxSize == 0U)
{
/* Complete transfer, will disable rx interrupt */
LPUART_DRV_CompleteReceiveDataUsingInt(instance);
LPUART_DRV_ReceiveData(1,&rxbuff,1);

}
}
}
}

/* Handle transmitter data register empty interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_TX_DATA_REG_EMPTY))
{
if (LPUART_GetStatusFlag(base, LPUART_TX_DATA_REG_EMPTY))
{
/* Check if there are any more bytes to send */
if (lpuartState->txSize > 0U)
{
/* Invoke callback if there is one */
if (lpuartState->txCallback != NULL)
{
lpuartState->txCallback(lpuartState, UART_EVENT_TX_EMPTY, lpuartState->txCallbackParam);
}
else
{
/* Transmit the data */
LPUART_DRV_PutData(instance);

/* Update the internal state */
if (lpuartState->bitCountPerChar == LPUART_8_BITS_PER_CHAR)
{
++lpuartState->txBuff;
--lpuartState->txSize;
}
else
{
++lpuartState->txBuff;
++lpuartState->txBuff;
lpuartState->txSize -= 2U;
}

/* Finish the transmission if this was the last byte */
if (lpuartState->txSize == 0U)
{
/* Complete transfer, will disable tx interrupt */
LPUART_DRV_CompleteSendDataUsingInt(instance);
}
}
}
}
}

/* Handle receive overrun interrupt */
if (LPUART_GetStatusFlag(base, LPUART_RX_OVERRUN))
{
lpuartState->receiveStatus = STATUS_UART_RX_OVERRUN;
/* Clear the flag, OR the rxDataRegFull will not be set any more */
(void)LPUART_ClearStatusFlag(base, LPUART_RX_OVERRUN);
}
}

void LPUART_DRV_IRQHandler(uint32_t instance)
{
DEV_ASSERT(instance < LPUART_INSTANCE_COUNT);

lpuart_state_t * lpuartState = (lpuart_state_t *)s_lpuartStatePtr[instance];
LPUART_Type * base = s_lpuartBase[instance];

/* Exit the ISR if no transfer is happening for this instance. */
if (!lpuartState->isTxBusy)
{
if (!lpuartState->isRxBusy)
{
return;
}
}

/* Handle receive data full interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_RX_DATA_REG_FULL))
{
if (LPUART_GetStatusFlag(base, LPUART_RX_DATA_REG_FULL))
{
/* Invoke callback if there is one */
if (lpuartState->rxCallback != NULL)
{
lpuartState->rxCallback(lpuartState, UART_EVENT_RX_FULL, lpuartState->rxCallbackParam);
}
else
{
/* Get data and put in receive buffer */
LPUART_DRV_GetData(instance);

/* Update the internal state */
if (lpuartState->bitCountPerChar == LPUART_8_BITS_PER_CHAR)
{
++lpuartState->rxBuff;
--lpuartState->rxSize;
}
else
{
++lpuartState->rxBuff;
++lpuartState->rxBuff;
lpuartState->rxSize -= 2U;
}

/* Finish reception if this was the last byte received */
if (lpuartState->rxSize == 0U)
{
/* Complete transfer, will disable rx interrupt */
LPUART_DRV_CompleteReceiveDataUsingInt(instance);
LPUART_DRV_ReceiveData(1,&rxbuff,1);

}
}
}
}

/* Handle transmitter data register empty interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_TX_DATA_REG_EMPTY))
{
if (LPUART_GetStatusFlag(base, LPUART_TX_DATA_REG_EMPTY))
{
/* Check if there are any more bytes to send */
if (lpuartState->txSize > 0U)
{
/* Invoke callback if there is one */
if (lpuartState->txCallback != NULL)
{
lpuartState->txCallback(lpuartState, UART_EVENT_TX_EMPTY, lpuartState->txCallbackParam);
}
else
{
/* Transmit the data */
LPUART_DRV_PutData(instance);

/* Update the internal state */
if (lpuartState->bitCountPerChar == LPUART_8_BITS_PER_CHAR)
{
++lpuartState->txBuff;
--lpuartState->txSize;
}
else
{
++lpuartState->txBuff;
++lpuartState->txBuff;
lpuartState->txSize -= 2U;
}

/* Finish the transmission if this was the last byte */
if (lpuartState->txSize == 0U)
{
/* Complete transfer, will disable tx interrupt */
LPUART_DRV_CompleteSendDataUsingInt(instance);
}
}
}
}
}

/* Handle receive overrun interrupt */
if (LPUART_GetStatusFlag(base, LPUART_RX_OVERRUN))
{
lpuartState->receiveStatus = STATUS_UART_RX_OVERRUN;
/* Clear the flag, OR the rxDataRegFull will not be set any more */
(void)LPUART_ClearStatusFlag(base, LPUART_RX_OVERRUN);
}
}

0 件の賞賛
返信