1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我现在使用STM32H743 uart3 的dma 接收数据,程序一运行,出现 Warning: There is no enough buffer for saving data, please increase the RT_SERIAL_RB_BUFSZ option. 这是什么原因呢? |
|
相关推荐
11个回答
|
|
RT_SERIAL_RB_BUFSZ 你查找一下现在的大小
|
|
|
|
开启DMA模式接收需要使用buffer,并且buffer的尺寸要正确设定。
|
|
|
|
我使用
` config.baud_rate = BAUD_RATE_9600; config.data_bits = DATA_BITS_8; config.stop_bits = STOP_BITS_1; config.bufsz = 1024*4; //修改缓冲区 buff size 为 512 config.parity = PARITY_NONE; //无奇偶校验位 / step3:控制串口设备。通过控制接口传入命令控制字,与控制参数 / rt_device_control(serial, RT_DEVICE_CTRL_CONFIG, &config); ` 配置的这个bufsz 可以么?是这样用么?谢谢 |
|
|
|
你修改的位置不对呀。
|
|
|
|
这里也改了
define RT_USING_DEVICE_IPC define RT_PIPE_BUFSZ 512 define RT_USING_SERIAL define RT_SERIAL_USING_DMA define RT_SERIAL_RB_BUFSZ 4096 define RT_USING_PIN 不行,仿真运行的时候只要一执行 result=rt_device_open(serial, RT_DEVICE_FLAG_DMA_RX); 在串口终端就会打印出 ope[W/UART] Warning: There is no enough buffer for saving data, please increase the RT_SERIAL_RB_BUFSZ option. ning: There is no enougmsh > |
|
|
|
现在串口打印的信息又多了一些:
msh >Serial_com_sample init message queue success!. o[W/UART] Warning: There is no enough buffer for saving data, please increase the RT_SERIAL_RB_BUFSZ option. input the receiver callback! input the receiver buf is : nput the receiver buf is thread: recv msg from msg queue, the content:? msh >thread:Serial_c?stack overflow thread pri status sp stack size max used left tick error -------- --- ------- ---------- ---------- ------ ---------- --- Serial_c 15 running 0x00001480 0x00000800 03% 0x00000005 -02 tshell 20 suspend 0x00000110 0x00001000 08% 0x00000004 000 tidle0 31 ready 0x00000054 0x00000400 08% 0x00000017 000 什么问题呢?不知道从哪入手了 |
|
|
|
把任务堆栈改成
static char Serial_com_t_stack[1024*8]; 后变为 这样了,没有堆栈错误了 ,还是有以前的错误 msh >Serial_com_sample init message queue success!. o[W/UART] Warning: There is no enough buffer for saving data, please increase the RT_SERIAL_RB_BUFSZ option. input the receiver callback! input the receiver buf is : nput the receiver buf is thread: recv msg from msg queue, the content:? msh > |
|
|
|
现在我调试代码是一进入 串口3的接收回调函数 ,终端就会打印出
[W/UART] Warning: There is no enough buffer for saving data, please increase the RT_SERIAL_RB_BUFSZ option. |
|
|
|
我的dma配置代码有问题么?
#ifdef RT_SERIAL_USING_DMA static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) { struct rt_serial_rx_fifo *rx_fifo; DMA_HandleTypeDef *DMA_Handle; struct dma_config *dma_config; struct stm32_uart *uart; RT_ASSERT(serial != RT_NULL); uart = rt_container_of(serial, struct stm32_uart, serial); if (RT_DEVICE_FLAG_DMA_RX == flag) { DMA_Handle = &uart->dma_rx.handle; dma_config = uart->config->dma_rx; } else if (RT_DEVICE_FLAG_DMA_TX == flag) { DMA_Handle = &uart->dma_tx.handle; dma_config = uart->config->dma_tx; } LOG_D("%s dma config start", uart->config->name); { rt_uint32_t tmpreg = 0x00U; #if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32L0) /* enable DMA clock && Delay after an RCC peripheral clock enabling*/ SET_BIT(RCC->AHBENR, dma_config->dma_rcc); tmpreg = READ_BIT(RCC->AHBENR, dma_config->dma_rcc); #elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G4) /* enable DMA clock && Delay after an RCC peripheral clock enabling*/ SET_BIT(RCC->AHB1ENR, dma_config->dma_rcc); tmpreg = READ_BIT(RCC->AHB1ENR, dma_config->dma_rcc); #if (defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G4)) && defined(DMAMUX1) /* enable DMAMUX clock for L4+ and G4 */ __HAL_RCC_DMAMUX1_CLK_ENABLE(); #endif #endif UNUSED(tmpreg); /* To avoid compiler warnings */ } if (RT_DEVICE_FLAG_DMA_RX == flag) { __HAL_LINKDMA(&(uart->handle), hdmarx, uart->dma_rx.handle); } else if (RT_DEVICE_FLAG_DMA_TX == flag) { __HAL_LINKDMA(&(uart->handle), hdmatx, uart->dma_tx.handle); } #if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32L0) DMA_Handle->Instance = dma_config->Instance; #elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) DMA_Handle->Instance = dma_config->Instance; DMA_Handle->Init.Channel = dma_config->channel; #elif defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) DMA_Handle->Instance = dma_config->Instance; DMA_Handle->Init.Request = dma_config->request; #endif DMA_Handle->Instance =DMA1_Stream1; DMA_Handle->Init.PeriphInc = DMA_PINC_DISABLE; DMA_Handle->Init.MemInc = DMA_MINC_ENABLE; DMA_Handle->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; DMA_Handle->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; if (RT_DEVICE_FLAG_DMA_RX == flag) { DMA_Handle->Init.Direction = DMA_PERIPH_TO_MEMORY; DMA_Handle->Init.Mode = DMA_NORMAL ; } else if (RT_DEVICE_FLAG_DMA_TX == flag) { DMA_Handle->Init.Direction = DMA_MEMORY_TO_PERIPH; DMA_Handle->Init.Mode = DMA_NORMAL; } DMA_Handle->Init.Priority = DMA_PRIORITY_MEDIUM; #if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) DMA_Handle->Init.FIFOMode = DMA_FIFOMODE_DISABLE; #endif if (HAL_DMA_DeInit(DMA_Handle) != HAL_OK) { RT_ASSERT(0); } if (HAL_DMA_Init(DMA_Handle) != HAL_OK) { RT_ASSERT(0); } /* enable interrupt */ if (flag == RT_DEVICE_FLAG_DMA_RX) { rx_fifo = (struct rt_serial_rx_fifo *)serial->serial_rx; /* Start DMA transfer */ if (HAL_UART_Receive_DMA(&(uart->handle), rx_fifo->buffer, serial->config.bufsz) != HAL_OK) { /* Transfer error in reception process */ RT_ASSERT(0); } CLEAR_BIT(uart->handle.Instance->CR3, USART_CR3_EIE); __HAL_UART_ENABLE_IT(&(uart->handle), UART_IT_IDLE); } /* enable irq */ HAL_NVIC_SetPriority(dma_config->dma_irq, 0, 0); HAL_NVIC_EnableIRQ(dma_config->dma_irq); HAL_NVIC_SetPriority(uart->config->irq_type, 1, 0); HAL_NVIC_EnableIRQ(uart->config->irq_type); LOG_D("%s dma %s instance: %x", uart->config->name, flag == RT_DEVICE_FLAG_DMA_RX ? "RX" : "TX", DMA_Handle->Instance); LOG_D("%s dma config done", uart->config->name); } |
|
|
|
这个你没有及时读取中断缓冲的数据导致,你不读取或者读取速度比接收速度慢很多,就算你放10K也没用
|
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
655 浏览 0 评论
AI模型部署边缘设备的奇妙之旅:如何在边缘端部署OpenCV
2448 浏览 0 评论
tms320280021 adc采样波形,为什么adc采样频率上来波形就不好了?
1292 浏览 0 评论
1895 浏览 0 评论
1486 浏览 0 评论
74867 浏览 21 评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 17:38 , Processed in 0.620497 second(s), Total 59, Slave 53 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号