完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
在rtt studio平台,芯片是STM32f429,串口3和串口4配置接收中断或者DMA模式都OK;串口8配置中断接收模式,收发都OK,但是配置成DMA模式该串口8不工作(发送和接收都没有)。
求助:将串口8配置成DMA收发模式可以正常工作。 /* 串口485方向GPIO设置 */ rt_pin_mode(rs485_dir1, PIN_MODE_OUTPUT); rt_pin_write(rs485_dir1, PIN_LOW); /* 查找串口设备 */ u2_dev = rt_device_find("uart2"); |
|
相关推荐
2个回答
|
|
驱动配置没写完
|
|
|
|
drv_usart.c文件中stm32_uart_get_dma_config只配置了uart1~6的DMA,uart7和uart8需要自己加一下
static void stm32_uart_get_dma_config(void) { #ifdef BSP_USING_UART1 uart_obj[UART1_INDEX].uart_dma_flag = 0; #ifdef BSP_UART1_RX_USING_DMA uart_obj[UART1_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; static struct dma_config uart1_dma_rx = UART1_DMA_RX_CONFIG; uart_config[UART1_INDEX].dma_rx = &uart1_dma_rx; #endif #ifdef BSP_UART1_TX_USING_DMA uart_obj[UART1_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; static struct dma_config uart1_dma_tx = UART1_DMA_TX_CONFIG; uart_config[UART1_INDEX].dma_tx = &uart1_dma_tx; #endif #endif #ifdef BSP_USING_UART2 uart_obj[UART2_INDEX].uart_dma_flag = 0; #ifdef BSP_UART2_RX_USING_DMA uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; static struct dma_config uart2_dma_rx = UART2_DMA_RX_CONFIG; uart_config[UART2_INDEX].dma_rx = &uart2_dma_rx; #endif #ifdef BSP_UART2_TX_USING_DMA uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; static struct dma_config uart2_dma_tx = UART2_DMA_TX_CONFIG; uart_config[UART2_INDEX].dma_tx = &uart2_dma_tx; #endif #endif #ifdef BSP_USING_UART3 uart_obj[UART3_INDEX].uart_dma_flag = 0; #ifdef BSP_UART3_RX_USING_DMA uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; static struct dma_config uart3_dma_rx = UART3_DMA_RX_CONFIG; uart_config[UART3_INDEX].dma_rx = &uart3_dma_rx; #endif #ifdef BSP_UART3_TX_USING_DMA uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; static struct dma_config uart3_dma_tx = UART3_DMA_TX_CONFIG; uart_config[UART3_INDEX].dma_tx = &uart3_dma_tx; #endif #endif #ifdef BSP_USING_UART4 uart_obj[UART4_INDEX].uart_dma_flag = 0; #ifdef BSP_UART4_RX_USING_DMA uart_obj[UART4_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; static struct dma_config uart4_dma_rx = UART4_DMA_RX_CONFIG; uart_config[UART4_INDEX].dma_rx = &uart4_dma_rx; #endif #ifdef BSP_UART4_TX_USING_DMA uart_obj[UART4_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; static struct dma_config uart4_dma_tx = UART4_DMA_TX_CONFIG; uart_config[UART4_INDEX].dma_tx = &uart4_dma_tx; #endif #endif #ifdef BSP_USING_UART5 uart_obj[UART5_INDEX].uart_dma_flag = 0; #ifdef BSP_UART5_RX_USING_DMA uart_obj[UART5_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; static struct dma_config uart5_dma_rx = UART5_DMA_RX_CONFIG; uart_config[UART5_INDEX].dma_rx = &uart5_dma_rx; #endif #ifdef BSP_UART5_TX_USING_DMA uart_obj[UART5_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; static struct dma_config uart5_dma_tx = UART5_DMA_TX_CONFIG; uart_config[UART5_INDEX].dma_tx = &uart5_dma_tx; #endif #endif #ifdef BSP_USING_UART6 uart_obj[UART6_INDEX].uart_dma_flag = 0; #ifdef BSP_UART6_RX_USING_DMA uart_obj[UART6_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; static struct dma_config uart6_dma_rx = UART6_DMA_RX_CONFIG; uart_config[UART6_INDEX].dma_rx = &uart6_dma_rx; #endif #ifdef BSP_UART6_TX_USING_DMA uart_obj[UART6_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; static struct dma_config uart6_dma_tx = UART6_DMA_TX_CONFIG; uart_config[UART6_INDEX].dma_tx = &uart6_dma_tx; #endif #endif } |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
529 浏览 0 评论
1841 浏览 0 评论
如何使用python调起UDE STK5.2进行下载自动化下载呢?
2178 浏览 0 评论
开启全新AI时代 智能嵌入式系统快速发展——“第六届国产嵌入式操作系统技术与产业发展论坛”圆满结束
2677 浏览 0 评论
获奖公布!2024 RT-Thread全球巡回线下培训火热来袭!报名提问有奖!
29088 浏览 11 评论
72156 浏览 21 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-9 13:51 , Processed in 0.365646 second(s), Total 44, Slave 37 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号