uart_div_modify failed!

wjzhang
Posts: 25
Joined: Thu Jul 30, 2015 9:56 am

uart_div_modify failed!

Postby wjzhang » Tue Oct 20, 2015 6:24 pm

Hi: the ESP8266 standard boot-vx.x.bin did not meet our requirement. i write another boot firmware. the UART driver is copy from normal firmware(USER1/USER2), it's working fine. but it in boot firmware. it's seem the baudrate setting is wrong.
difference between these 2 UART driver:
1) boot uart driver no interrupt support
2) boot uart driver all function run in RAM. no ICACHE_FLASH_ATTR.

baudrate at 230400: send are 0xC0, 0x16, 0x06, 0x40, 0x00, 0x00, 0xxx, 0xxx, 0xC0, receive are 0x90, 0x8a, 0x40, 0xd9, 0xf0

could someone tell me why the uart_div_modify() failed?

wjzhang
Posts: 25
Joined: Thu Jul 30, 2015 9:56 am

Re: uart_div_modify failed!

Postby wjzhang » Wed Oct 21, 2015 9:07 am

sorry, forget another difference: the boot call uart initalize at call_user_start(), the normal firmware(USER1) call uart initalize at user_init().

Thanks for your help!

wjzhang
Posts: 25
Joined: Thu Jul 30, 2015 9:56 am

Re: uart_div_modify failed!

Postby wjzhang » Thu Oct 22, 2015 12:16 pm

Hi I'm found a interest thing. the PC baudrate set to 230400. the ESP8266 baudrate set to 354461. the ESP8266 will receive right datas.
230400/354461 = 0.65. it seem the CPU freq in call_user_start() is 80Mhz * 0.65 = 52Mhz.
Could some tell me what's going on? :?

costaud
Posts: 138
Joined: Fri Oct 24, 2014 7:40 pm

Re: uart_div_modify failed!

Postby costaud » Mon Oct 26, 2015 3:57 pm

wjzhang wrote:Hi I'm found a interest thing. the PC baudrate set to 230400. the ESP8266 baudrate set to 354461. the ESP8266 will receive right datas.
230400/354461 = 0.65. it seem the CPU freq in call_user_start() is 80Mhz * 0.65 = 52Mhz.
Could some tell me what's going on? :?


Hello,

How do you write the boot loader, does Espressif send you some reference code ?

The problem is , before the digital part has been initialized , the system clock is set to double of the crystal frequency.

That's why if you are using a 40M crystal the uart output is at baud 115200, and if you are using a 26M crystal the uart output is at baud 74880 during booting up. 115200/74880 = 40M / 26M = 80M / 52M.

wjzhang
Posts: 25
Joined: Thu Jul 30, 2015 9:56 am

Re: uart_div_modify failed!

Postby wjzhang » Mon Oct 26, 2015 6:04 pm

Hi costaud:
Thanks for your information. unfortunately i did not get reference code from Espressif. i reference the richard RBOOT project.
write the source code , Makefile, tool generate the headfile...
{http://richard.burtons.org/}


Best regards!
ZhangWenjin

Who is online

Users browsing this forum: No registered users and 12 guests