Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
ESP8266 crystal frequency not set (Read 549 times)
DisplayNamesSuck
Newbies
*
Offline



Posts: 1
ESP8266 crystal frequency not set
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).
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 9628
United Kingdom
Re: ESP8266 crystal frequency not set
Reply #1 - 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?
Back to top
« Last Edit: Aug 21st, 2018 at 7:08pm by Visual Micro »  
WWW  
IP Logged
 
mallar
Junior Member
**
Offline



Posts: 5
Re: ESP8266 crystal frequency not set
Reply #2 - 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)
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 9628
United Kingdom
Re: ESP8266 crystal frequency not set
Reply #3 - 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
Back to top
« Last Edit: Feb 7th, 2019 at 8:25pm by Visual Micro »  
WWW  
IP Logged
 
mallar
Junior Member
**
Offline



Posts: 5
Re: ESP8266 crystal frequency not set
Reply #4 - Feb 7th, 2019 at 8:25pm
 
esp8266-12F.
I program it as Generic ESP8266 Module. Both Arduino IDE and vMicro
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 9628
United Kingdom
Re: ESP8266 crystal frequency not set
Reply #5 - 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
Back to top
 
WWW  
IP Logged
 
mallar
Junior Member
**
Offline



Posts: 5
Re: ESP8266 crystal frequency not set
Reply #6 - 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.
Back to top
 

vMicroShot.PNG (128 KB | 0 )
vMicroShot.PNG
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 9628
United Kingdom
Re: ESP8266 crystal frequency not set
Reply #7 - 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 





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 



The boards.txt can be found here...
C:\Users\[YOUR NAME]\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.4.1
Back to top
« Last Edit: Feb 7th, 2019 at 10:13pm by Visual Micro »  
WWW  
IP Logged
 
mallar
Junior Member
**
Offline



Posts: 5
Re: ESP8266 crystal frequency not set
Reply #8 - 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....
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 9628
United Kingdom
Re: ESP8266 crystal frequency not set
Reply #9 - 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.
Back to top
« Last Edit: Feb 8th, 2019 at 11:15pm by Visual Micro »  
WWW  
IP Logged
 
mallar
Junior Member
**
Offline



Posts: 5
Re: ESP8266 crystal frequency not set
Reply #10 - Feb 9th, 2019 at 12:30pm
 
Thank you for the support again!
I'm looking forward to the release Smiley
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print