SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.52k stars 491 forks source link

ESP-12F stuck. #588

Closed xerdink closed 6 years ago

xerdink commented 6 years ago

Hi everyone, thanks for your work firstly.

I have a ESP-12F module. I flashed some of the examples to try out but it always stops at

rBoot v1.4.0 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   QIO
Flash Speed:  40 MHz
rBoot Option: Big flash
rBoot Option: RTC data

Booting rom 0.

I have changed parameters.mk for 4 MB flash size. I did not change common.mk by the way.

Thanks

flannelhead commented 6 years ago

Hi, please try doing a full mass erase with esptool, then reuploading the firmware. That has worked for me before.

xerdink commented 6 years ago

Hi @flannelhead thanks for your answer but unfortunately it does not work :(

nochkin commented 6 years ago

I would try to play with flash modes to see if you need DIO or DOUT set.

xerdink commented 6 years ago

@nochkin I was using QIO before and I have tried all of modes.. no success..

ourairquality commented 6 years ago

You might need to trace how far it is getting to find some more clues. See core/led_debug.s So turn the led on/off as needed at some stage in the early boot, and keep moving it further in the source to locate where it is stopping. For a start try at the start of sdk_user_start in core/app_main.c

Zaltora commented 6 years ago

I got some ESP-12F and work it is work with DIO mode (i don't no why is not work on QIO, because it is a QIO model). Anyway i will get soon ESP-12S and will do some test on it. Take care about TX pin, when i design some PCB, i have detected this pin need to not be pulled to GND or you will get some boot problem.

chenli2015 commented 6 years ago

I meet the same problem with default rboot.bin. But I use espressif's official download tool. After several hours debug, the problem seems to be resolved!

  1. I add some code to rboot.c to support new flash size flag for 5 and 6, so rboot could recognize the flash size.
  2. And then print the boot rom address which is got from the config.bin section of the flash, so we could determine if the boot rom address is correct.
  3. rebuild the bootloader.
  4. flash bootloader.bin, config.bin, you-app.bin with the following config: flash size 32M, spi mode dio, ...
  5. resolved!

rboot.c at line 281: // print and get flash size ets_printf("Flash Size: "); flag = header->flags2 >> 4; if (flag == 0) { ets_printf("4 Mbit\r\n"); flashsize = 0x80000; } else if (flag == 1) { ets_printf("2 Mbit\r\n"); flashsize = 0x40000; } else if (flag == 2) { ets_printf("8 Mbit\r\n"); flashsize = 0x100000; } else if (flag == 3 || flag == 5) { ets_printf("16 Mbit\r\n");

ifdef BOOT_BIG_FLASH

    flashsize = 0x200000;

else

    flashsize = 0x100000; // limit to 8Mbit

endif

} else if (flag == 4 || flag == 6) {
    ets_printf("32 Mbit\r\n");

ifdef BOOT_BIG_FLASH

    flashsize = 0x400000;

else

    flashsize = 0x100000; // limit to 8Mbit

endif

} else {
    ets_printf("unknown\r\n");
    // assume at least 4mbit
    flashsize = 0x80000;
}

line 451: ets_printf("Rom %d at %x is bad.\r\n", romToBoot, romconf->roms[romToBoot]); line 490: ets_printf("Booting rom %d from %x, run at ram %x.\r\n", romToBoot, romconf->roms[romToBoot], runAddr);

config.bin setting: e1 01 00 00 00 01 00 00 00 00 20 00 ......(all 0s)

Zaltora commented 6 years ago

Never put TX pin to GND at start, esp8266 will never boot. I don't know why. It is can be a hardware problem. Tested it again with ESP-12S

xerdink commented 6 years ago

@chenli2015 thanks for your solution. I will try this as soon as possible and let you know. I also think that main cause is apparently rboot bootloader.

apiel commented 6 years ago

Did you solve your issue, cause I have the same problem?

chenli2015 commented 6 years ago

@apiel did you use the same flash tool like me? the problem is new flash partition type not support by "old" rboot.

apiel commented 6 years ago

Yes, i was looking at rboot.c and it has the content as u mentioned in your previous message.

Thx, hopefully someone will find the solution :-)

fvpalha commented 6 years ago

@chenli2015 do you have more details about the changes on rboot? Some link to the new code?

xerdink commented 6 years ago

Hi again, sorry for late reply. I did what @chenli2015 said and it seems to be resolved. Thanks again. So, I am closing it.

apiel commented 6 years ago

I tried to do exactly what is mentioned by @chenli2015 without success

I flash it with: esptool.py -p /dev/ttyUSB0 --baud 115200 write_flash -fs 32m -fm dio -ff 40m 0x0 ../../bootloader/firmware/rboot.bin 0x1000 ../../bootloader/firmware_prebuilt/blank_config.bin 0x2000 ./firmware/blink.bin

image

Any more idea?

chenli2015 commented 6 years ago

@apiel Please try my config.bin setting: e1 01 00 00 00 01 00 00 00 00 20 00 ......(all 0s) Not flash blank_config at 0x1000

apiel commented 6 years ago

What do you means? How can I do this?

Thanks for your help ;-)

On Tue, 24 Apr 2018, 03:19 chenli2015, notifications@github.com wrote:

@apiel https://github.com/apiel Please try my config.bin setting: e1 01 00 00 00 01 00 00 00 00 20 00 ......(all 0s) Not flash blank_config at 0x1000

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SuperHouse/esp-open-rtos/issues/588#issuecomment-383772028, or mute the thread https://github.com/notifications/unsubscribe-auth/AFmeLm-w6z_qbQ3CSHhVwCpnBnUgdzY0ks5trn2NgaJpZM4SjYwS .

xerdink commented 6 years ago

@apiel download a hex editor (i.e GHex in Linux) and open config.bin file and change its contents as @chenli2015 says.

fvpalha commented 6 years ago

Wich is the file config.bin? where?

chenli2015 commented 6 years ago

@apiel @fvpalha open "bootloader" floder and you will see "firmware_prebuilt" floder. just open it. there may has a file named "blank_config.bin". Use a hex editor to config it with the following setting: e1 01 00 00 00 01 00 00 00 00 20 00 ......(all 0s)

ourairquality commented 6 years ago

Submitted a PR for rboot https://github.com/raburton/rboot/pull/37 and a PR to update esp-open-rtos to the current rboot master https://github.com/SuperHouse/esp-open-rtos/pull/617 and a little more support in esp-open-rtos https://github.com/SuperHouse/esp-open-rtos/pull/616

Could I ask which flash tool is causing the problems, and does the current esptool not work for some configurations? Just not clear from the discussion why the modified config.bin is even necessary?

apiel commented 6 years ago

image image @chenli2015 Even with following your instruction, it not working :-/ Do I do something wrong?

chenli2015 commented 6 years ago

@apiel No problem for all steps. Try the following steps to debug:

  1. clear flash and ensure that it is really cleared!
  2. flash rboot.bin, config.bin, firmware one by one and reset after each burn, watch the boot information.
  3. ensure the firmware works