To illustrate the procedure the list below enumerates the steps necessary to get DTR-less downloading working at a non-standard speed using a wired serial connection. Once that process is understood, adding a wireless connection will be simpler.
- Connect the serial port of the PC directly to the device (through level shifters), including the DTR signal.
- Configure the IDE to use DTR toggling for downloading (uncheck "Use ATN character" on the Serial Port Options dialog).
- Configure the IDE for the default execution baud rate of 19200.
- Compile and download the program below with the Option ConsoleSpeed directive commented out or set to 19200.
- Observe that the Debug window contains the signon message and the "Hello, world" output, confirming that Com1 baud rate is actually 19200.
- Uncomment the Option ConsoleSpeed directive in the test program and ensure that it is set to 9600. Recompile and download the modified program. (You may want to change the Debug.Print message to confirm that a new program has been downloaded.)
- Observe that the Debug window contains garbage text, indicating a baud rate mismatch (the device is now operating at 9600 baud but the IDE is still operating at 19200).
- Change the "Execution baud rate" in the IDE to 9600. Then, either reset the device (with a reset switch or using "Reset Device" on the Options menu) or just download again.
- Observe that the latest output in the Debug window is now correct. Note that the IDE's execution baud rate could have been changed before downloading the program containing a console speed change but this will only work correctly if you're using the DTR toggling download method.
- Disconnect the DTR signal from the device and, optionally, confirm that you can no longer download (Device failed to respond to ATN signal...).
- Configure the IDE for ATN Character downloading and ensure that the "Change speed for download" checkbox is unchecked.
- Attempt to download again and observe that it is successful (and that downloading is obviously slower than before - it's being done at 9600 baud) and the Debug window contains the expected output.
- Change the Option ConsoleSpeed value to 38400 but do not change the IDE's execution baud rate yet.
- Compile and download the program, observing that the download completes successfully but that the latest output in the Debug window is garbage.
- Now that the device is operating at 38400, change the IDE's execution baud rate to match. Download again and observe that the latest output in the Debug window is now correct.
Test Program:
Code: Select all
Option ATNChar &H04
Option ConsoleSpeed 9600
Sub Main()
Debug.Print "Hello, world! 1"
End Sub