Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By cherowley
#56737 Hi!

I'm trying to reflash a commercial wifi socket with my own firmware.

When trying to flash using the espriff tool it fails with invalid header. Using any flashing util works but the code doesn't run. I've since tried flashing some of the small arduino examples and while they flash and run there are 2 problems:

1) the wifi doesn't appear to work - nothing found.

And the strange one - setting the baud to say 9600 in code (Serial.begin(9600);) results in the com port only being readable at 14400!!

And using Serial.begin(74880) the port is only readable at 115200?!

Anyone got any idea?

Using reliable psu, soldered connections etc and the plug worked ok with its own firmware..

The flash chip marking are:

Winbond 25Q????NIG / 1516
User avatar
By piersfinlayson
#56760 Sounds to me like the device has a 40MHz crystal, rather than the usual 26Mhz crystal.

26MHz crystal is what leads to the default 74,880 baud rate. If you put a 40MHz crystal on it will come out at 115200 (the ROM will just output at a set rate dependant on the crystal).

The SDK reads the configured crystal value - this is supposed to be stored on the flash in a well-known location. If you leave it as the default it will assume a 26Mhz crustal, so speeds will come out at about 50% faster than you expect.

This also means wifi won't work (fundamentally your device is just clocked wrong). I've built my own esp8266 module with a 40Mhz crystal and hit the same "issues" with baud rate, and wifi didn't work until I'd configured the SDK properly.

Some more details here:

http://www.esp8266.com/viewtopic.php?f=13&t=8119
User avatar
By cherowley
#56784 Hey thanks buddy I thought it may be something like but wasn't sure :)

Thanks for the link too, I'm away till Sunday so will be looking into this early next week..

I'm hoping this will allow me to get the larger programs running too.. i think the flash size is 1Mbyte but my old eyes can't read the full markings doh!
User avatar
By cherowley
#57024 Hi!

I've started looking into this but am somewhat stumped.

I tend to compile my code in the arduino environment so my single .bin file is flashed to location 0.

The arduino wifi example compiled bin is only 226k so doesn't have location 0x7C030?


Also to check I understand what is going on, I presume that the arduino code is creating a bin which assumes a 26mhz xtal right? This would mean that the ideal solution would be to have additional compile options to specify xtal speed in the arduino enviroment yes?

Thanks :)