Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) ESP8266 crystal frequency not set (Read 5186 times)
DisplayNamesSuck
Junior Member
**
Offline


Posts: 11
Joined: Aug 19th, 2018
ESP8266 crystal frequency not set
Aug 19th, 2018 at 6:24pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266 crystal frequency not set
Reply #1 - Aug 21st, 2018 at 6:08pm
Print Post  
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?
« Last Edit: Aug 21st, 2018 at 6:08pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
mallar
Newbies
*
Offline


Posts: 5
Joined: Feb 7th, 2019
Re: ESP8266 crystal frequency not set
Reply #2 - Feb 7th, 2019 at 7:45pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266 crystal frequency not set
Reply #3 - Feb 7th, 2019 at 8:18pm
Print Post  
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
« Last Edit: Feb 7th, 2019 at 8:25pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
mallar
Newbies
*
Offline


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


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266 crystal frequency not set
Reply #5 - Feb 7th, 2019 at 8:26pm
Print Post  
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
Newbies
*
Offline


Posts: 5
Joined: Feb 7th, 2019
Re: ESP8266 crystal frequency not set
Reply #6 - Feb 7th, 2019 at 8:53pm
Print Post  
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.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266 crystal frequency not set
Reply #7 - Feb 7th, 2019 at 10:12pm
Print Post  
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
Select All
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
Select All
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
Select All
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
« Last Edit: Feb 7th, 2019 at 10:13pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
mallar
Newbies
*
Offline


Posts: 5
Joined: Feb 7th, 2019
Re: ESP8266 crystal frequency not set
Reply #8 - Feb 8th, 2019 at 7:06am
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP8266 crystal frequency not set
Reply #9 - Feb 8th, 2019 at 11:14pm
Print Post  
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.
« Last Edit: Feb 8th, 2019 at 11:15pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
mallar
Newbies
*
Offline


Posts: 5
Joined: Feb 7th, 2019
Re: ESP8266 crystal frequency not set
Reply #10 - Feb 9th, 2019 at 12:30pm
Print Post  
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 TopicPrint