Other Parts Discussed in Thread: AM62P, SYSCONFIG
部件号: AM62P
主题: SysConfig 中讨论的其他器件
您好、
我尝试在 AM62P 与目标电路板上的 GMSL 芯片和我使用的 MCU+SDK 版本之间建立通信、版本为 11.01.08。
当前情况是我可以 成功实现 uart_echo 示例。 在这个工程中、我使用自封装 API 进行 UART 传输。 下面附上了嗅探代码。
status = SemaphoreP_constructBinary(&gUartWriteDoneSem_gmsl1, 0);
status = SemaphoreP_constructBinary(&gUartReadDoneSem_gmsl1, 0);
uint8_t gUartTxBuffer[200] __attribute__((aligned(CacheP_CACHELINE_ALIGNMENT)));
uint8_t gUartRxBuffer[8] __attribute__((aligned(CacheP_CACHELINE_ALIGNMENT)));
strncpy(&gUartTxBuffer[0],"[MCU] uart DMA test. Please enter\r\n", 200);
length = strlen(&gUartTxBuffer[0]);
status = uart_txEncap(0, gUartTxBuffer, length);
status = uart_rxEncap(0, gUartRxBuffer, 8);
status = uart_txEncap(0, gUartRxBuffer, 8);
strncpy(&gUartTxBuffer[0],"\r\n[MCU] At the end of test... \r\n", 200);
length = strlen(&gUartTxBuffer[0]);
status = uart_txEncap(0, gUartTxBuffer, length);
下面显示了自封装 API 的嗅探代码。
int32_t uart_txEncap(uint8_t u8_core_sel, uint8_t *tx_AppBuffer, uint32_t tx_bufSize)
{
int32_t status;
UART_Transaction uartTrans;
/* Cache write-back before DMA - ensures DMA reads updated data from memory */
CacheP_wb((void *)&tx_AppBuffer[0], tx_bufSize, CacheP_TYPE_ALL);
UART_Transaction_init(&uartTrans);
uartTrans.count = tx_bufSize;
uartTrans.buf = &tx_AppBuffer[0U];
status = UART_write(gUartHandle[u8_core_sel], &uartTrans);
UART_flushTxFifo(gUartHandle[u8_core_sel]);
if (u8_core_sel == 0)
{
SemaphoreP_pend(&gUartWriteDoneSem_gmsl1, SystemP_WAIT_FOREVER);
}
else if (u8_core_sel == 1)
{
SemaphoreP_pend(&gUartWriteDoneSem_gmsl2, SystemP_WAIT_FOREVER);
}
if (SystemP_SUCCESS != (status))
{
return status;
}
else
{
return SystemP_SUCCESS;
}
}
int32_t uart_rxEncap(uint8_t u8_core_sel, uint8_t *rx_AppBuffer, uint32_t rx_bufSize, uint32_t semaPend_us)
{
int32_t status;
UART_Transaction uartTrans;
uint32_t lineStatus, atLeastCharInFifo = 0;
/* Cache write-back before DMA - ensures DMA reads updated data from memory */
CacheP_wbInv((void *)&rx_AppBuffer[0], rx_bufSize, CacheP_TYPE_ALL);
UART_Transaction_init(&uartTrans);
uartTrans.count = rx_bufSize;
uartTrans.buf = &rx_AppBuffer[0U];
status = UART_read(gUartHandle[u8_core_sel], &uartTrans);
if (u8_core_sel == 0)
{
SemaphoreP_pend(&gUartReadDoneSem_gmsl1, SystemP_WAIT_FOREVER);
}
else if (u8_core_sel == 1)
{
SemaphoreP_pend(&gUartReadDoneSem_gmsl2, SystemP_WAIT_FOREVER);
}
if (SystemP_SUCCESS != (status))
{
return status;
}
else
{
return SystemP_SUCCESS;
}
}
下面证明了测试结果、我认为一切都运行良好。 对于 SysConfig 配置、波特率为 115200、UART 配置为 DMA+回调模式、我使用的外设硬件为 USART3。 

直到现在,一切都正常工作,我尝试使用这些封装的 API 来与 GMSL 通信。 SysConfig 不需要进行任何更改、只是其波特率为 1M Hz。 但我发现我无法收到 GMSL 的响应。 进行调试时、我发现 UART_TX 的状态成功、程序在 UART_rxEncap 中阻塞、 这意味着 soc 不会收到 GMSL 的响应。 但是、我可以在 UART_RX 线路上测量正确的信号、如下所示。 我想知道为什么会发生这种情况?
uint8_t tx_buf1[4] __attribute__((aligned(CacheP_CACHELINE_ALIGNMENT)))= {0x79, 0xC5, 0x08, 0x01};
uint8_t rx_buf1[2] __attribute__((aligned(CacheP_CACHELINE_ALIGNMENT)))= { 0 };
status = uart_txEncap(0, tx_buf1, 4);
status = uart_rxEncap(0, rx_buf1, 2);

此致、
Bomiao
