In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
STM32-Printf how to use DMA mode output, for this problem, this article details the corresponding analysis and solution, hoping to help more want to solve this problem of small partners to find a simpler and easier way.
1. Simple printf print, rewrite the underlying fputc on the line
int fputc(int ch, FILE *f){ while (__HAL_UART_GET_FLAG(&huart1, UART_FLAG_TC) == RESET) {} HAL_UART_Transmit(&huart1, (uint8_t*) &ch,1,0xFF); return ch;}
2. Print via DMA
void Usart1DmaPrintf(const char *format,...) { uint16_t len; va_list args; va_start(args,format); len = vsnprintf((char*)UartTxBuf,sizeof(UartTxBuf)+1,(char*)format,args); va_end(args); HAL_UART_Transmit_DMA(&huart1, UartTxBuf, len);}
UartTxBuf inside can be applied as a global variable, as long as the length is appropriate. Or allocate memory dynamically, and then reclaim memory in DMA send completion interrupt. Local variables applied within a function may be recycled and used elsewhere, causing other effects.
About STM32-Printf how to use DMA mode output questions to share the answer here, I hope the above content can be of some help to everyone, if you still have a lot of doubts not solved, you can pay attention to the industry information channel to learn more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.