RTOS SDK 1.3.0 UART_SetBaudrate undefined issue

htjgdw
Posts: 2
Joined: Thu Feb 04, 2016 9:57 am

RTOS SDK 1.3.0 UART_SetBaudrate undefined issue

Postby htjgdw » Thu Feb 04, 2016 10:02 am

I try to add one line(UART_SetBaudrate function) in examples/project_template/user/user_main.c but compile fail. What configuration needed to use APIs in examples/driver_lib/ ?

Code: Select all

#include "esp_common.h"
#include "uart.h"

/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{
   [color=#FF0000]UART_SetBaudrate(UART0, 115200);[/color]
    printf("SDK version:%s\n", system_get_sdk_version());
   printf("ESP8266 chip ID: 0x%x\n", system_get_chip_id());
}

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: RTOS SDK 1.3.0 UART_SetBaudrate undefined issue

Postby ESP_Faye » Thu Feb 04, 2016 3:15 pm

Hi,

You can check the makefile whether it contains the "driver" or not.

Code: Select all

SUBDIRS=    \
   user    \
   driver


Thanks for your interest in ESP8266 !

htjgdw
Posts: 2
Joined: Thu Feb 04, 2016 9:57 am

Re: RTOS SDK 1.3.0 UART_SetBaudrate undefined issue

Postby htjgdw » Thu Feb 04, 2016 4:30 pm

Hi,
I add driver line in Makefile follow your advice, and copy driver folder(copy from driver_lib/) into projet_template/, and copy driver header file into project_template/include/
Currently, a new error occur as following.

hw_timer.c: In function 'hw_timer_init':
hw_timer.c:79:5: error: passing argument 2 of '_xt_isr_attach' from incompatible pointer type [-Werror]
_xt_isr_attach(ETS_FRC_TIMER1_INUM, hw_timer_isr_cb, NULL);
^
In file included from /home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/freertos/portable.h:318:0,
from /home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/freertos/FreeRTOS.h:87,
from /home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/spiffs/spiffs_config.h:18,
from /home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/spiffs/spiffs.h:16,
from /home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/espressif/esp_spiffs.h:28,
from /home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/espressif/esp_common.h:102,
from hw_timer.c:25:
/home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/include/freertos/portmacro.h:186:13: note: expected '_xt_isr' but argument is of type 'void (*)(void)'
void _xt_isr_attach (uint8 i, _xt_isr func, void *arg);
^
cc1: all warnings being treated as errors
make[1]: *** [.output/eagle/debug/obj/hw_timer.o] 错误 1
make[1]:正在离开目录 `/home/hw/esp_8266/ESP8266_RTOS_SDK_1.3.0/examples/project_template/driver'
make: *** [.subdirs] 错误 2

magdaleneratna
Posts: 1
Joined: Wed Dec 16, 2015 3:09 pm

Re: RTOS SDK 1.3.0 UART_SetBaudrate undefined issue

Postby magdaleneratna » Fri Mar 11, 2016 7:01 pm

This works for me.

UART_SetBaudrate(UART_Port uart_no, uint32 baud_rate)
{
WRITE_PERI_REG(UART_CLKDIV(uart_no), (UART_CLK_FREQ / baud_rate));
}

I could change the baud rate to 115200.

Who is online

Users browsing this forum: No registered users and 14 guests