diff --git a/core/app_main.c b/core/app_main.c index e7297ad..215f606 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -278,8 +278,8 @@ static void init_networking(uint8_t *phy_info, uint8_t *mac_addr) { printf("FATAL: sdk_register_chipv6_phy failed"); halt(); } - uart_set_baud(0, 115200); - uart_set_baud(1, 115200); + uart_set_baud(0, 74906); + uart_set_baud(1, 74906); sdk_phy_disable_agc(); sdk_ieee80211_phy_init(sdk_g_ic.s.phy_mode); sdk_lmacInit(); diff --git a/examples/blink/blink.c b/examples/blink/blink.c index 8f34ee5..00388b5 100644 --- a/examples/blink/blink.c +++ b/examples/blink/blink.c @@ -3,6 +3,7 @@ * This sample code is in the public domain. */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "esp8266.h" @@ -52,6 +53,7 @@ void blinkenRegisterTask(void *pvParameters) void user_init(void) { + uart_set_baud(0, 115200); xTaskCreate(blinkenTask, (signed char *)"blinkenTask", 256, NULL, 2, NULL); //xTaskCreate(blinkenRegisterTask, (signed char *)"blinkenRegisterTask", 256, NULL, 2, NULL); } diff --git a/examples/blink_timers/blink_timers.c b/examples/blink_timers/blink_timers.c index fd9b000..177cff3 100644 --- a/examples/blink_timers/blink_timers.c +++ b/examples/blink_timers/blink_timers.c @@ -3,6 +3,7 @@ * This sample code is in the public domain. */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "esp8266.h" @@ -32,6 +33,8 @@ void frc2_interrupt_handler(void) void user_init(void) { + uart_set_baud(0, 115200); + /* configure GPIOs */ gpio_enable(gpio_frc1, GPIO_OUTPUT); gpio_enable(gpio_frc2, GPIO_OUTPUT); diff --git a/examples/bmp180_i2c/bmp180_i2c.c b/examples/bmp180_i2c/bmp180_i2c.c index 073fc55..64ee961 100644 --- a/examples/bmp180_i2c/bmp180_i2c.c +++ b/examples/bmp180_i2c/bmp180_i2c.c @@ -3,6 +3,7 @@ * This sample code is in the public domain. */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" @@ -82,9 +83,22 @@ void bmp180_task(void *pvParameters) } } +// Setup HW +void user_setup(void) +{ + // Set UART Parameter + uart_set_baud(0, 115200); + + // Give the UART some time to settle + sdk_os_delay_us(500); +} + void user_init(void) { - // Just some informations + // Setup HW + user_setup(); + + // Just some infomations printf("\n"); printf("SDK version : %s\n", sdk_system_get_sdk_version()); printf("GIT version : %s\n", GITSHORTREV); diff --git a/examples/button/button.c b/examples/button/button.c index b8c7fdd..0b0784d 100644 --- a/examples/button/button.c +++ b/examples/button/button.c @@ -6,6 +6,7 @@ * This sample code is in the public domain. */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" @@ -74,6 +75,7 @@ void GPIO_HANDLER(void) void user_init(void) { + uart_set_baud(0, 115200); gpio_enable(gpio, GPIO_INPUT); tsqueue = xQueueCreate(2, sizeof(uint32_t)); diff --git a/examples/cpp_01_tasks/cpp_tasks.cpp b/examples/cpp_01_tasks/cpp_tasks.cpp index 13b0cbc..1a54129 100644 --- a/examples/cpp_01_tasks/cpp_tasks.cpp +++ b/examples/cpp_01_tasks/cpp_tasks.cpp @@ -31,6 +31,8 @@ #include "espressif/esp_common.h" +#include "esp/uart.h" + /****************************************************************************************************************** * task_1_t * @@ -94,6 +96,8 @@ esp_open_rtos::thread::queue_t MyQueue; */ extern "C" void user_init(void) { + uart_set_baud(0, 115200); + MyQueue.queue_create(10); task_1.queue = MyQueue; diff --git a/examples/experiments/timers/timers.c b/examples/experiments/timers/timers.c index 8c1bca8..d5a2f50 100644 --- a/examples/experiments/timers/timers.c +++ b/examples/experiments/timers/timers.c @@ -7,6 +7,7 @@ * This experimental reverse engineering code is in the public domain. */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "esp8266.h" @@ -117,6 +118,7 @@ void frc2_handler(void) void user_init(void) { + uart_set_baud(0, 115200); xTaskCreate(timerRegTask, (signed char *)"timerRegTask", 1024, NULL, 2, NULL); TIMER(0).CTRL = VAL2FIELD(TIMER_CTRL_CLKDIV, TIMER_CLKDIV_256) | TIMER_CTRL_RELOAD; diff --git a/examples/experiments/unaligned_load/unaligned_load.c b/examples/experiments/unaligned_load/unaligned_load.c index 8af7025..48016af 100644 --- a/examples/experiments/unaligned_load/unaligned_load.c +++ b/examples/experiments/unaligned_load/unaligned_load.c @@ -3,6 +3,7 @@ #include "esp/rom.h" #include "esp/timer.h" #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" @@ -213,6 +214,8 @@ void sanity_tests(void); void user_init(void) { + uart_set_baud(0, 115200); + gpio_enable(2, GPIO_OUTPUT); /* used for LED debug */ gpio_write(2, 1); /* active low */ diff --git a/examples/http_get/http_get.c b/examples/http_get/http_get.c index 6822194..b90abdf 100644 --- a/examples/http_get/http_get.c +++ b/examples/http_get/http_get.c @@ -5,7 +5,7 @@ * This sample code is in the public domain., */ #include "espressif/esp_common.h" -#include "espressif/sdk_private.h" +#include "esp/uart.h" #include @@ -114,6 +114,7 @@ void http_get_task(void *pvParameters) void user_init(void) { + uart_set_baud(0, 115200); printf("SDK version:%s\n", sdk_system_get_sdk_version()); struct sdk_station_config config = { diff --git a/examples/http_get_mbedtls/http_get_mbedtls.c b/examples/http_get_mbedtls/http_get_mbedtls.c index f050fdd..f10385e 100644 --- a/examples/http_get_mbedtls/http_get_mbedtls.c +++ b/examples/http_get_mbedtls/http_get_mbedtls.c @@ -10,7 +10,7 @@ * Additions Copyright (C) 2015 Angus Gratton, Apache 2.0 License. */ #include "espressif/esp_common.h" -#include "espressif/sdk_private.h" +#include "esp/uart.h" #include @@ -331,6 +331,7 @@ void http_get_task(void *pvParameters) void user_init(void) { + uart_set_baud(0, 115200); printf("SDK version:%s\n", sdk_system_get_sdk_version()); struct sdk_station_config config = { diff --git a/examples/ota_basic/ota_basic.c b/examples/ota_basic/ota_basic.c index 3bffa4e..a6d354d 100644 --- a/examples/ota_basic/ota_basic.c +++ b/examples/ota_basic/ota_basic.c @@ -7,6 +7,7 @@ * NOT SUITABLE TO PUT ON THE INTERNET OR INTO A PRODUCTION ENVIRONMENT!!!! */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "esp8266.h" @@ -17,6 +18,8 @@ void user_init(void) { + uart_set_baud(0, 115200); + rboot_config_t conf = rboot_get_config(); printf("\r\n\r\nOTA Basic demo.\r\nCurrently running on flash slot %d / %d.\r\n\r\n", conf.current_rom, conf.count); diff --git a/examples/serial_echo/serial_echo.c b/examples/serial_echo/serial_echo.c index cea3f33..5be9ff4 100644 --- a/examples/serial_echo/serial_echo.c +++ b/examples/serial_echo/serial_echo.c @@ -10,6 +10,7 @@ void user_init(void) { + uart_set_baud(0, 115200); printf("SDK version:%s\n", sdk_system_get_sdk_version()); printf("Going into echo mode...\n"); diff --git a/examples/simple/simple.c b/examples/simple/simple.c index 7044119..d95a040 100644 --- a/examples/simple/simple.c +++ b/examples/simple/simple.c @@ -1,6 +1,7 @@ /* Very basic example that just demonstrates we can run at all! */ #include "espressif/esp_common.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" @@ -35,6 +36,7 @@ static xQueueHandle mainqueue; void user_init(void) { + uart_set_baud(0, 115200); printf("SDK version:%s\n", sdk_system_get_sdk_version()); mainqueue = xQueueCreate(10, sizeof(uint32_t)); xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL); diff --git a/examples/simple_cplusplus/simple.cpp b/examples/simple_cplusplus/simple.cpp index 688475d..dec286d 100644 --- a/examples/simple_cplusplus/simple.cpp +++ b/examples/simple_cplusplus/simple.cpp @@ -7,6 +7,8 @@ #include "task.h" #include "queue.h" +#include + class Counter { private: @@ -57,6 +59,7 @@ void task1(void *pvParameters) extern "C" void user_init(void) { + uart_set_baud(0, 115200); printf("SDK version:%s\n", sdk_system_get_sdk_version()); xTaskCreate(task1, (signed char *)"tsk1", 256, NULL, 2, NULL); } diff --git a/examples/tests/hmac_test_vectors/hmac_test_vectors.c b/examples/tests/hmac_test_vectors/hmac_test_vectors.c index a6a20f9..d0ed1de 100644 --- a/examples/tests/hmac_test_vectors/hmac_test_vectors.c +++ b/examples/tests/hmac_test_vectors/hmac_test_vectors.c @@ -8,7 +8,7 @@ * This sample code is in the public domain., */ #include "espressif/esp_common.h" -#include "espressif/sdk_private.h" +#include "esp/uart.h" #include "FreeRTOS.h" #include "mbedtls/md.h" @@ -130,7 +130,7 @@ static void test_md5(void) void user_init(void) { - sdk_uart_div_modify(0, UART_CLK_FREQ / 115200); + uart_set_baud(0, 115200); test_md5();