-
请问HC32LF136的开发板LPuart0如何复用? sos
我在官方提供的样例库中将LPuart1修改成了PB10和PB11的脚复用成LPuart0,但是发现一直未复用成功,请问一下哪里配置错了吗?///
1266浏览量 0回复量 关注量 -
GD32F103RB映射UART0到PB6,PB7失败怎么解决?
[color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] 我在作用GD32F103RB时,LQFP64将串口0重映射到PB6,PB7时串口发送数据时无输出。用示波器测量IO口无波形。但是串口中断可以进去。[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] PB6 - Remap: USART_RX[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] PB7 - Remap: USART_TX[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]//初始化程序如下:[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]nvic_irq_enable(USART0_IRQn, 14, 0); //[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]// remap uart0[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]rcu_periph_clock_enable(RCU_AF); [/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]gpio_pin_remap_config(GPIO_USART0_REMAP,ENABLE);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]/* enable GPIO clock */[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]rcu_periph_clock_enable( RCU_GPIOB); // clock already seted[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]rcu_periph_clock_enable( RCU_GPIOB);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]/* connect port to USARTx_Tx */[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]gpio_init(GPIOB, GPIO_MODE_OUT_OD, GPIO_OSPEED_2MHZ, GPIO_PIN_6);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]/* connect port to USARTx_Rx */[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]gpio_init(GPIOB, GPIO_MODE_OUT_OD, GPIO_OSPEED_2MHZ, GPIO_PIN_7);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]/* enable USART clock */[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]rcu_periph_clock_enable(RCU_USART0);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]/* USART configure */[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_deinit(USART0);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_baudrate_set(USART0, 9600);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_word_length_set(USART0, USART_WL_8BIT);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_stop_bit_set(USART0, USART_STB_1BIT);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_parity_config(USART0, USART_PM_NONE);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_hardware_flow_rts_config(USART0, USART_RTS_DISABLE);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_hardware_flow_cts_config(USART0, USART_CTS_DISABLE);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_receive_config(USART0, USART_RECEIVE_ENABLE);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_transmit_config(USART0, USART_TRANSMIT_ENABLE);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]usart_enable(USART0);[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]// interrupt enable[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]//usart_interrupt_enable(USART0, USART_INT_TBE);[/size][/font][/backcolor][/color]
4609浏览量 2回复量 关注量 -
求助-GD32F103RB将UART0重映射到PB6,PB7上无输出是怎么回事?
我在作用GD32F103RB时,LQFP64将串口0重映射到PB6,PB7时串口发送数据时无输出。用示波器测量IO口无波形。但是串口中断可以进去。 PB6 - Remap: USART_RX PB7 - Remap: USART_TX //初始化程序如下: nvic_irq_enable(USART0_IRQn, 14, 0); // // remap uart0 rcu_periph_clock_enable(RCU_AF); gpio_pin_remap_config(GPIO_USART0_REMAP,ENABLE); /* enable GPIO clock */ rcu_periph_clock_enable( RCU_GPIOB); // clock already seted rcu_periph_clock_enable( RCU_GPIOB); /* connect port to USARTx_Tx */ gpio_init(GPIOB, GPIO_MODE_OUT_OD, GPIO_OSPEED_2MHZ, GPIO_PIN_6); /* connect port to USARTx_Rx */ gpio_init(GPIOB, GPIO_MODE_OUT_OD, GPIO_OSPEED_2MHZ, GPIO_PIN_7); /* enable USART clock */ rcu_periph_clock_enable(RCU_USART0); /* USART configure */ usart_deinit(USART0); usart_baudrate_set(USART0, 9600); usart_word_length_set(USART0, USART_WL_8BIT); usart_stop_bit_set(USART0, USART_STB_1BIT); usart_parity_config(USART0, USART_PM_NONE); usart_hardware_flow_rts_config(USART0, USART_RTS_DISABLE); usart_hardware_flow_cts_config(USART0, USART_CTS_DISABLE); usart_receive_config(USART0, USART_RECEIVE_ENABLE); usart_transmit_config(USART0, USART_TRANSMIT_ENABLE); usart_enable(USART0); // interrupt enable //usart_interrupt_enable(USART0, USART_INT_TBE);
8917浏览量 3回复量 关注量 -
GD32E103VB Uart0 sos
为什么我用的GD32E103VB 的Uart打印出来是乱码。。。代码如下:#include "gd32e10x.h" #include "gd32e103v_eval.h" #include "systick.h" #include
/* retarget the C library printf function to the USART */ int fputc(int ch, FILE *f) { usart_data_transmit(USART0, (uint8_t)ch); while(RESET == usart_flag_get(USART0, USART_FLAG_TBE)); return ch; } void uart_init(void) { rcu_periph_clock_enable(RCU_AF); /* enable GPIO clock */ rcu_periph_clock_enable(RCU_GPIOA); //gpio_pin_remap_config(GPIO_USART0_REMAP,ENABLE); /* enable USART clock */ rcu_periph_clock_enable(RCU_USART0); /* connect port to USARTx_Tx */ gpio_init(GPIOA, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_9); /* connect port to USARTx_Rx */ gpio_init(GPIOA, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_10); //gpio_pin_remap_config(GPIO_USART0_REMAP,ENABLE); /* USART configure */ usart_deinit(USART0); usart_baudrate_set(USART0, 115200U); usart_receive_config(USART0, USART_RECEIVE_ENABLE); usart_transmit_config(USART0, USART_TRANSMIT_ENABLE); usart_enable(USART0); } int main(void) { systick_config(); uart_init(); while(1) { printf("hello world\n"); } } 打印结果如下: l"l"Xl"H$ ll"l"XlDl"l。。。。。。 2243浏览量 0回复量 关注量 -
华大HC32L136 LPUART0异常
采用hc32l13x_ddl_Rev1.9.1 Lite 里面example目录下的lpuart示例,将串口IO适配成自己硬件板子,板子TX\RX接线到PC端;1. 发送时钟引用PCLK,与PC端通信正常; 2. 发送时钟用内部RCL(38.4K),数据发送不出来,并且PC端给硬件发送数据,也无中断触发; stcCfg.enStopBit = LPUart1bit; ///<1停止位 stcCfg.enMmdorCk = LPUartDataOrAddr; ///<偶校验 stcCfg.stcBaud.enSclkSel = LPUartMskRcl; ///<传输时钟源 stcCfg.stcBaud.u32Sclk = 38400; ///
2034浏览量 8回复量 关注量