Visual Micro
https://www.visualmicro.com/forums/YaBB.pl
Visual Micro >> General Board >> ESP8266 crystal frequency not set
https://www.visualmicro.com/forums/YaBB.pl?num=1534703052

Message started by DisplayNamesSuck on Aug 19th, 2018 at 7:24pm

Title: ESP8266 crystal frequency not set
Post by DisplayNamesSuck on Aug 19th, 2018 at 7:24pm
When I program my ESP8266 generic module using vmicro, it is setting the wrong crystal frequency.  Arduino works just fine.  This is using the "Generic ESP8266 Module".  The result is none of the wifi works and the serial runs at 74880 instead of 115200. (40mhz/26mhz * 74880 = 115200).

Title: Re: ESP8266 crystal frequency not set
Post by Visual Micro on Aug 21st, 2018 at 7:08pm
Each board implements a set of speeds that can be selected by you on the vMicro menu below the Board selection menu.

In the Arduino IDE the selection is below the Board selection menu.

Does this make sense?

Title: Re: ESP8266 crystal frequency not set
Post by mallar on Feb 7th, 2019 at 7:45pm
Hello There!
The first post was right. You can not change (or at least the vMicro ignores) the crystal frequency and always use 40Mhz.
When I configure the Frequency to 26Mhz in the arduino IDE (all the other settings the same) The Program works. Write hello world to uart with 115200 baud.
But when I use the vMicro with the same code, same settings.
It writes uart with 74880 baud (What makes sense due to the wrong crystal frequency)

Title: Re: ESP8266 crystal frequency not set
Post by Visual Micro on Feb 7th, 2019 at 8:18pm
Please state which esp8266 package you are using thanks. I have the default package installed from board manager v2.4.1

Please ensure that vMicro>Crystal frequency is set to 40

Also switch on vMicro>Compiler>Verbose and you will see the crystal setting in the build output.

I see this:-

-DF_CRYSTAL=40000000

Title: Re: ESP8266 crystal frequency not set
Post by mallar on Feb 7th, 2019 at 8:25pm
esp8266-12F.
I program it as Generic ESP8266 Module. Both Arduino IDE and vMicro

Title: Re: ESP8266 crystal frequency not set
Post by Visual Micro on Feb 7th, 2019 at 8:26pm
You installed a board package into the arduino ide what is the .json url?

I have the normal esp8266 package installed v2.4.1

Please ensure that vMicro>Crystal frequency is set to 40

Also switch on vMicro>Compiler>Verbose and you will see the crystal setting in the build output.

I see this:-

-DF_CRYSTAL=40000000

Title: Re: ESP8266 crystal frequency not set
Post by mallar on Feb 7th, 2019 at 8:53pm
I don't know about the .json of the board package. Where can I find that?

Here is the settings and the verbose output attached.
vMicroShot.PNG (128 KB | )

Title: Re: ESP8266 crystal frequency not set
Post by Visual Micro on Feb 7th, 2019 at 10:12pm
Oh I see, sorry I forgot you wanted 26mhz and not 40.

The problem is because the esp definition does not provide any flags for 26mhz therefore the last used flags for that menu setting are used. We will adjust that in future visual micro versions.

A short term workaround might be to create a local project board.txt and add the following line. A board.txt is just a text file, the visual micro "Add/Add Code" menus create one for you or you can add to the project one yourself :-

Code (]build.extra_flags=-DESP8266[/code):
An alternative solution is to add a definition line to the boards.txt in the platform folder

This is what you currently have in boards
[code]menu.CrystalFreq.26=26 MHz
menu.CrystalFreq.40=40 MHz
menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266


This is how it will look with a definition for the 26mhx crystal which is the default so the speed doesn't need to be set
[code]menu.CrystalFreq.26=26 MHz
menu.CrystalFreq.26.build.extra_flags=-DESP8266
menu.CrystalFreq.40=40 MHz
menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266[/code]

The boards.txt can be found here...
C:\Users\[YOUR NAME]\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.4.1

Title: Re: ESP8266 crystal frequency not set
Post by mallar on Feb 8th, 2019 at 7:06am
Thank you!
I'll try this workaround and waiting for the adjuatment in the next versions!
I'll never go back to the Arduino ide....

Title: Re: ESP8266 crystal frequency not set
Post by Visual Micro on Feb 8th, 2019 at 11:14pm
There is a fix in the next release but it is not in the gallery yet. The version is available here Pre-Release 2902.8 forum thread

Thanks for the report and all the info, sorry it rook so long to resolve.

Title: Re: ESP8266 crystal frequency not set
Post by mallar on Feb 9th, 2019 at 12:30pm
Thank you for the support again!
I'm looking forward to the release :)

Visual Micro » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2020. All Rights Reserved.