完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
效仿uart_echo的uart0通信,采用uart3,请问为什么发可以,但是收不可以
//***************************************************************************** // // The UART interrupt handler. // //***************************************************************************** void UARtintHandler(void) [ uint32_t ui32Status; // // Get the interrrupt status. // ui32Status = ROM_UARTIntStatus(UART3_BASE, true); // // Clear the asserted interrupts. // ROM_UARTIntClear(UART3_BASE, ui32Status); // // Loop while there are characters in the receive FIFO. // while(ROM_UARTCharsAvail(UART3_BASE)) [ // // Read the next character from the UART and write it back to the UART. // ROM_UARTCharPutNonBlocking(UART3_BASE, ROM_UARTCharGetNonBlocking(UART3_BASE)); // // Blink the LED to show a character transfer is occuring. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); // // Delay for 1 millisecond. Each SysCtlDelay is about 3 clocks. // SysCtlDelay(SysCtlClockGet() / (1000 * 3)); // // Turn off the LED // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); ] ] //***************************************************************************** // // Send a string to the UART. // //***************************************************************************** void UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count) [ // // Loop while there are more characters to send. // while(ui32Count--) [ // // Write the next character to the UART. // ROM_UARTCharPutNonBlocking(UART3_BASE, *pui8Buffer++); ] ] //***************************************************************************** // // This example demonstrates how to send a string of data to the UART. // //***************************************************************************** int main(void) [ //ʹÄÜFPU ROM_FPUEnable(); ROM_FPULazyStackingEnable(); //ÉèÖÃʱÖÓÖ±½ÓʹÓÃÍⲿ¾§ÕñÔ´ ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); //ʹÄÜLEDËùÓÃ¶Ë¿Ú ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //ʹÄÜÒý½Å ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); //ʹÄÜÍâÉè ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); //ʹÄÜÖÕ¶Ë ROM_IntMasterEnable(); //ÅäÖô®¿Úuart3µÄÒý½Å GPIOPinConfigure(GPIO_PC6_U3RX); GPIOPinConfigure(GPIO_PC7_U3TX); ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7); //115,200, 8-N-1 operation. ROM_UARTConfigSetExpClk(UART3_BASE, ROM_SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); //ʹÄÜUART ROM_IntEnable(INT_UART3); ROM_UARTIntEnable(UART3_BASE, UART_INT_RX | UART_INT_RT); // // Prompt for text to be entered. // UARTSend((uint8_t *)"TEST ", 55); // // Loop forever echoing data through the UART. // while(1) [ ] ] |
|
相关推荐
5 个讨论
|
|
|
没看到你写串口的接收函数,你是怎么判断不能接收的呢?接收函数类似这样的,把接收到的数据发送出去 do [ // // Read a character using the blocking read function. This function // will not return until a character is available. // cThisChar = UARTCharGet(UART0_BASE); // // Write the same character using the blocking write function. This // function will not return until there was space in the FIFO and // the character is written. // UARTCharPut(UART0_BASE, cThisChar); ] |
|
|
|
|
|
|
|
ljmlvmd 发表于 2019-9-6 08:56 请问下有没有SPI例程,我没找到,串口是因为我忘记中断地址指向中断函数 |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
549 浏览 0 评论
1613 浏览 0 评论
2047 浏览 0 评论
为啥BQ7693003DBTR芯片在和BQ769X0盒子通讯时收不到信号?
1513 浏览 0 评论
DSP 28027F 开发板 XDS100v2调试探针诊断日志显示了 Error -150 (SC_ERR_FTDI_FAIL)如何解决
1337 浏览 0 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
1757浏览 29评论
2781浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
1724浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
1634浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
1645浏览 13评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 11:48 , Processed in 0.800970 second(s), Total 70, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
3296