请教outman,我用的是开发板供应商的简单串口程序,现在要测试通过串口调试助手发出去的数据,节点是否收到数据,这个应该怎么测试呢?我自己直接在static uint16 HalUARTReadDMA(uint8 *buf, uint16 len)这个函数里面的填了一行将DMA里的数据显示到LCD上的代码:void HalLcdWriteString(buf,HAL_LCD_LINE2);
添加完这行代码之后的函数:
/*****************************************************************************
* @fn HalUARTReadDMA
*
* @brief Read a buffer from the UART
*
* @param buf - valid data buffer at least 'len' bytes in size
* len - max length number of bytes to copy to 'buf'
*
* @return length of buffer that was read
*****************************************************************************/
static uint16 HalUARTReadDMA(uint8 *buf, uint16 len)
{
uint16 cnt;
for (cnt = 0; cnt < len; cnt++)
{
if (!HAL_UART_DMA_NEW_RX_BYTE(dmaCfg.rxHead))
{
break;
}
*buf++ = HAL_UART_DMA_GET_RX_BYTE(dmaCfg.rxHead);
void HalLcdWriteString(buf,HAL_LCD_LINE2);//这行是我自己添加的
HAL_UART_DMA_CLR_RX_BYTE(dmaCfg.rxHead);
if (++(dmaCfg.rxHead) >= HAL_UART_DMA_RX_MAX)
{
dmaCfg.rxHead = 0;
}
}
PxOUT &= ~HAL_UART_Px_RTS; // Re-enable the flow on any read.
return cnt;
}
是这样吗?请教outman |