Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

显示SHELL_TEXT_INFO,write函数返回的实际打印长度未被处理,导致信息显示不全 #196

Open
Sirius2334 opened this issue Aug 17, 2024 · 2 comments

Comments

@Sirius2334
Copy link

使用dma方式打印时,如果直接调用HAL_UART_Transmit_DMA,会在回显命令时调用频繁而出错,因此使用了环形缓冲。
但是如果缓冲区不够大,会导致shell信息打印不全。
直接使用HAL_UART_Transmit_DMA:
image
使用环形缓冲,大小为128Bytes:
image

@fool-cat
Copy link

SHELL_TEXT_INFO的信息大小大概有380+字节,所以发送缓冲区建议大于400字节,不然就考虑环形缓冲满了之后先等着发送完成之后再继续填充,我fork的仓库里面有一份参考可以试试

@Sirius2334
Copy link
Author

Sirius2334 commented Aug 25, 2024

SHELL_TEXT_INFO的信息大小大概有380+字节,所以发送缓冲区建议大于400字节,不然就考虑环形缓冲满了之后先等着发送完成之后再继续填充,我fork的仓库里面有一份参考可以试试

已经在写函数中处理了。我使用的缓冲是lwrb,可以返回实际写入的长度,因此使用该长度循环打印直到完成。这样缓冲区的长度可以少于400字节。
`
short userShellWrite(char *data, unsigned short len)
{
uint32_t sendLen = 0;
do
{
sendLen += uart_send_dma(&huart1, (uint8_t *)(data + sendLen), len - sendLen);
} while (sendLen < len);

return sendLen;

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants