|
本帖最后由 1112 于 2016-12-31 11:15 编辑
问题:怎么用串口1 输出os_printf内容呢?
1、我是这样尝试修改的:
- /**
- * @brief 程序入口函数
- * 在该函数中完成用户相关的初始化
- * @param none
- * @return none
- */
- void ICACHE_FLASH_ATTR user_init(void)
- {
- uint32 system_free_size = 0;
- wifi_station_set_auto_connect(1);
- wifi_set_sleep_type(NONE_SLEEP_T);//set none sleep mode
- espconn_tcp_set_max_con(10);
- uart_init_3(9600,115200);
- UART_SetPrintPort(1); <b>//串口1</b>
- os_printf( "---------------SDK version:%s--------------\n", system_get_sdk_version());
- os_printf( "system_get_free_heap_size=%d\n",system_get_free_heap_size());
复制代码- uart_init_3(UartBautRate uart0_br, UartBautRate uart1_br)
- {
- // rom use 74880 baut_rate, here reinitialize
- UartDev.baut_rate = uart0_br;
- UartDev.exist_parity = STICK_PARITY_DIS;
- UartDev.parity = NONE_BITS;
- UartDev.stop_bits = ONE_STOP_BIT;
- UartDev.data_bits = EIGHT_BITS;
- uart_config(UART0);
- UartDev.baut_rate = uart1_br;
- uart_config(UART1);
- ETS_UART_INTR_ENABLE();
- // install uart1 putc callback
- // os_install_putc1((void *)uart1_write_char);//print output at UART1
- }
复制代码
- UART_SetPrintPort(uint8 uart_no)
- {
- if(uart_no==1){
- os_install_putc1(uart1_write_char);
- }else{
- /*option 1: do not wait if uart fifo is full,drop current character*/
- os_install_putc1(uart0_write_char_no_wait);
- /*option 2: wait for a while if uart fifo is full*/
- os_install_putc1(uart0_write_char);
- }
- }
复制代码
2、接线
RX--GPIO2
GND---GND
3V---3V
3、波特率:74880
4、串口输出:
这样os_printf没有打印出内容,换串口0一切正常。
各位大神,这怎么解决?
|
|