Go Down

Topic: Bad Characters in serial monitor output (Read 2494 times) previous topic - next topic

ted

As I set before - your bad solution is a good one (the easiest) should not affect your project, I did not suspect your board. It is look like there is a separate driver for your board and separate drIver for serial monitor.

nate123456

Ted,

Yes, I suppose I do have some functionality. It's suspicious that it doesn't work the way it should.

I'm going to move on for now, as I'm having issues connecting to WiFi with both boards- they both do not detect any networks despite there being nearby networks, and do not connect to my network.

Thanks again for your help.

ted


ted

After receiving last info I should change in post  #30; you may have some problems to you will have problems.
I think you should send new email to Mr. James.
Results of driver testing.
1.  Serial Monitor is working ok for stm32f103
2, Serial Monitor is working  not ok for  ESP8266 when speed is setup correctly - 9600/9600
3. , Serial Monitor is working  ok for  ESP8266 when speed is setup  is setup incorrectly
(your numbers) ????/????
4. Flashing LED program is working ok in all cases.

ted

Add this drawing - problem location

ted



In meantime you can
1. change USB cable = 1% possibility of the problem
2. I restore PC to factory settings to date couple earlier then you instal the driver. 50%  of succes
3.use another PC uploading driver from aurdino site. 80%  of succes

nate123456

Ted,

I have already tried replacing the cables, but I'd rather not go through the trouble of restoring my PC to factory settings if I can avoid it. I'll look into using another PC to see if the behavior is different there.

Thank you for your suggestions.

ted

#82
Jan 11, 2018, 12:33 pm Last Edit: Jan 11, 2018, 12:38 pm by ted
I'm having issues connecting to WiFi with both boards

Bad solution is working for serial monitor where you are able to make changes in speeds, for WiFi you don't have such option.

Look on # of viewers, you are not alone who has such problem.

nate123456

Ted,

I agree, it does seem to be a strangely popular thread. Perhaps it is because of the length  :)

I am working on the WiFi issue over here for those who are following this thread:

https://forum.arduino.cc/index.php?topic=521752.0


After all this work we've done, I still can't shake the feeling that this thread has a valuable theory as to the issue:

https://arduino.stackexchange.com/questions/18106/arduino-outputs-garbage-values-on-serial-monitor-with-esp8266

See the last comment on the initial question:

   
ESP's come with two flavours of "Crystal Frequencies", 26MHz (most common in my experience) and 40MHz. ... now, 74880 * 40 / 26 = 115200. The fact that you are using serial.begin(74880) and this communicates at 115200 suggests that you have a 40MHz "Crystal" but flashing it with 26MHz setting, hence the serial speeds are 40/26 faster than the code sets it to. Trouble is, nodemcu "board" in arduino IDE has no "crystal frequency" settings

The last sentence indicating that there's no crystal frequency settings makes me think that the firmware needs to change this setting. What you do think?


ted

Read with concentration post #78 the first line - this is the answer to your post #
and #80, the red circle indicate the problem, do  #3.
The best answer I am expecting from James.
Make new topick - "to users  ESP8266 , who have no problem using serial monitor."

ted

look there
https://arduino.stackexchange.com/questions/18106/arduino-outputs-garbage-values-on-serial-monitor-with-esp8266

nate123456

Ted,

I have come across that post in the past, and it does seem related at first. One of the suggested fixes was to use an AT command to reduce the baud rate, but unfortunately this only works when the NodeMCU is being programmed by another board like a Uno or when it has AT firmware flashed, as the NodeMCU board by itself does not have AT firmware installed when using the Arduino IDE as the IDE installs custom firmware each time a sketch is uploaded.

At this point, I'm fairly certain that the issue I'm having has to do with the crystal frequency of my board being incorrectly set by the firmware being used. In other words, the firmware the board has installed on it is operating under the wrong information and as such is out of sync. Here's my evidence:

  • baud rate of board is out of sync. It only correctly outputs to serial monitor when 40/26 ratio is maintained as per stackexchange link in earlier posts.
  • WiFi does not connect- which needs correct clock speeds (as verified in another thread I linked above)
  • blink sketch delay(2000) occurs much faster than 2 seconds, which indicates incorrect internal timing.
  • Two different boards of the same make/model behave in exactly the same way. It is unlikely that both boards have the same hardware issue.

Since the Arduino IDE flashes custom firmware each time a sketch is uploaded, no amount of tinkering around with AT firmware or lua firmware externally will help. This is clear as each time the IDE uploads, the console outputs that it is writing to the flash memory @ 0x00000, and therefore overwrites any previously installed firmware.

After looking around, it seems to me that I need to somehow modify the firmware that the Arduino IDE flashes to the device to correctly set the crystal frequency of the board. The thread I have open on my WiFi issue is progressing in that direction. I am currently tinkering around with the boards.txt that the Arduino IDE uses to build the firmware.

I'll keep this thread updated with my findings and progress.

Thanks again for your help Ted.

Here's the WiFi issue thread for those who are interested: https://forum.arduino.cc/index.php?topic=521752.0

ted

I agree 95%, in wifi you have use bad solution method, here is link maybe this helps,.https://www.arduino.cc/en/Guide/ArduinoUnoWiFi

nate123456

Ted,

I found a resolution.

I posted my findings on the WiFi issues thread @ https://forum.arduino.cc/index.php?topic=521752.0 post # 13.

I had to change my crystal frequency by adding a flag to the firmware build in boards.txt. The fact that the firmware for this particular board does not do that automatically is incredible.

Here's the complete steps for those who wish to apply the fix:




Note- this is for my HiLetgo NodeMCU ESP8266 board. The fix will only work if your board actually runs @ 40 MHz. Also note that all of these steps assume you are using a Windows PC. If you are on another system, you'll have to adapt the steps for you, though it shouldn't be too difficult to do.


If you want to be certain as to what frequency your board operates at, follow these steps:

1. Go here(http://espressif.com/en/support/download/other-tools) and download the file called "Flash Download Tools (ESP8266 & ESP32)".

2. Extract the .rar file, and browse in the resulting folder to find 'ESPFlashDownloadTool_v3.6.3.exe' and run it.

3. Choose the top option in the popup window that says 'ESP8266 Download Tool'.

4. At the top of the resulting window will be a table with empty values. Make sure none of the rows are checked. The idea is to flash nothing to your device.

5. At the bottom right part of the window, select the correct COM port for your board. Mine was COM3.

6. Hit start. After a moment the DETECT INFO box will populate with information. Among this information is something like 'crystal: 40 Mhz'. This is your crystal frequency.

7. Close the tool.



Here are the steps to configure the Arduino IDE to the correct crystal rate:

1. Browse to the AppData folder for Arduino IDE. This is located at C:\Users\YourUser\AppData\Local\Arduino15\

2. Open the 'packages folder, then the esp8266 folder, then hardware, then esp8266, then the folder named after the current version (mine was 2.4.0-rc2). The total address for this is:

C:\Users\YourUser\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\

3. Open boards.txt with your favorite text file editor. use ctrl+f to find the board you're using in the Arduino IDE. For me it was the line 'nodemcuv2.name=NodeMCU 1.0 (ESP-12E Module)', so searching for NodeMCU 1.0 did the trick.

4. You should be looking at the section of text lines that start with the name of your board, for me it's nodemcuv2. Add an extra line somewhere in this section that starts with the name of your board, then complete it in the following manner:

nodemcuv2.build.extra_flags=-DF_CRYSTAL=40000000 (use 26000000 if that's what your crystal is)

Make sure to replace nodemcuv2 with the name of your board as is used in the section you're in.

5. Save the .txt file, exit your editor. Restart your Arduino IDE.

6. Send a test sketch to your board. Here's a simple one to test serial output:

Code: [Select]
void setup() {
  // put your setup code here, to run once:
 
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("test");
  delay(2000);
}


If this works then your crystal frequency is set correctly. You can further test this by running the example blink sketch which is at (in the Arduino IDE) File -> Examples -> ESP8266 -> Blink. While running this sketch, count the seconds between blinks- if it seems like 2 seconds, then you're probably good to go.

Note that you'll probably have to redo this procedure for each update your board has when downloaded from the boards manager in the IDE, since it'll probably completely replace that section of the .txt file.

I hope this is helpful to others out there who were stuck on this issue.

Thank you Ted for your continued help and support, and for the other helpers in the other thread I had @ https://forum.arduino.cc/index.php?topic=521752.0.

ted

Congratulations, I'm happy that you accomplished your goal.
Cheers, Ted.
What you going to do with you wifi ?

Go Up